@@ -112,6 +112,26 @@ private static CSVPrinter createCSVPrinter(String fileName, String[] header) thr
112
112
return new CSVPrinter (new FileWriter (fileName , true ), CSVFormat .EXCEL .withHeader (header ));
113
113
}
114
114
115
+ private static File findEvaluationPropertiesFile (File directory ) {
116
+ if (directory == null )
117
+ return null ;
118
+
119
+ if (!directory .isDirectory ())
120
+ throw new IllegalArgumentException ("Expecting directory: " + directory + "." );
121
+
122
+ File evaluationFile = directory .toPath ().resolve (EVALUATION_PROPERTIES_FILE_NAME ).toFile ();
123
+
124
+ if (evaluationFile != null && evaluationFile .exists ())
125
+ return evaluationFile ;
126
+ else
127
+ return findEvaluationPropertiesFile (directory .getParentFile ());
128
+ }
129
+
130
+ private static File findEvaluationPropertiesFile (IJavaProject project ) throws JavaModelException {
131
+ IPath location = project .getCorrespondingResource ().getLocation ();
132
+ return findEvaluationPropertiesFile (location .toFile ());
133
+ }
134
+
115
135
private static IType [] getAllDeclaringTypeSubtypes (IMethod method ) throws JavaModelException {
116
136
IType declaringType = method .getDeclaringType ();
117
137
ITypeHierarchy typeHierarchy = declaringType .newTypeHierarchy (new NullProgressMonitor ());
@@ -150,10 +170,9 @@ private static int getMethodLinesOfCode(IMethod method) {
150
170
151
171
private static int getNForStreams (IJavaProject project ) throws IOException , JavaModelException {
152
172
Properties properties = new Properties ();
153
- IPath filePath = project .getCorrespondingResource ().getLocation ().append (EVALUATION_PROPERTIES_FILE_NAME );
154
- File file = filePath .toFile ();
173
+ File file = findEvaluationPropertiesFile (project );
155
174
156
- if (file .exists ())
175
+ if (file != null && file .exists ())
157
176
try (Reader reader = new FileReader (file )) {
158
177
properties .load (reader );
159
178
0 commit comments