Repository navigation
Expand file tree
/
Copy pathAnalyzeFilesClient.java
More file actions
115 lines (86 loc) · 2.99 KB
/
Copy pathAnalyzeFilesClient.java
File metadata and controls
115 lines (86 loc) · 2.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
package Client;
import java.io.File;
import java.util.Iterator;
import java.util.List;
import utils.*;
import astparsing.*;
import java.util.logging.*;
import utils.*;
public class AnalyzeFilesClient {
public static String classpathfolder="";
public static List<String> classpathjars;
public static String clonedprojectsfolder="";
public static String sourcepathfinder="";
public static String ASTTraceFolder="";
public static void main(String args[])
{
try
{
//SET LOGGING
String cwd = new File("").getAbsolutePath();
String rootd = new File(cwd+"/..").getCanonicalPath();
System.out.println(rootd);
String LogFileFolder=args[0];
//LogFileFolder=cwd;
String logfilepath=LogFileFolder+"/Logs/ExecutionLog.txt";
String excplogfilepath=LogFileFolder+"/Logs/ExecutionLog.txt";
CustomLogger.setLogger(logfilepath);
ExceptionLogger.setLogger(excplogfilepath);
//LOAD FILES TO PARSE
//SET BELOW PATH TO TEXT FILE WHICH CONTIANS PATH OF ALL JAVE FILES
//String astfilelist="../TestProjectBugramSelf/alljavafiles.lst";
String astfilelist=args[1];
ReadFromFile readF=new ReadFromFile(astfilelist);
Iterator<String> iterator = readF.linesinfile.iterator();
//SET ENVVARIABLE
//AnalyzeFilesClient.classpathfolder="/home/oldmonk/.m2/repository";
AnalyzeFilesClient.classpathfolder=args[2];
AnalyzeFilesClient.classpathjars=Environments.setClassPath(AnalyzeFilesClient.classpathfolder);
String ASTFOLDER=args[3];
AnalyzeFilesClient.ASTTraceFolder=ASTFOLDER+"/ASTOutput";
//SET BELOW PATH TO CLONED PROJECTS FOLDER
String ClonedProjectsFolder=args[4];
AnalyzeFilesClient.clonedprojectsfolder=ClonedProjectsFolder+"/";
//AnalyzeFilesClient.clonedprojectsfolder=rootd+"/";
//ASUMMPTION
AnalyzeFilesClient.sourcepathfinder="/src/main/java/";
//PARSE FILES
while (iterator.hasNext())
{
String javafiletoprocess=iterator.next();
if(javafiletoprocess.contains(AnalyzeFilesClient.sourcepathfinder))
{
try
{
ParseAST parser=new ParseAST();
parser.SetParser(new BaselineBugramParser());
parser.ProcessFile(javafiletoprocess);
}
catch (Exception e)
{
//logger.info("Below Exception Occured for FIle " + javafiletoprocess);
//logger.info(e.toString());
CustomLogger.Log("Below Exception Occured for FIle " + javafiletoprocess);
CustomLogger.Log(e.toString());
}
}
else
{
System.out.println("File at path " + javafiletoprocess + " Ignored");
}
}
}
catch (Exception e)
{
///System.out.println("Below Exception Occured whiel Loading File List ");
System.out.println(e.toString());
CustomLogger.Log("Below Exception Occured whiel Loading File List ");
CustomLogger.Log(e.toString());
}
finally
{
System.out.println("Finished Processing");
CustomLogger.Log("Finished Processing");
}
}
}