File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed
soot-infoflow/test/soot/jimple/infoflow/test/junit Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change 2323import org .junit .Assume ;
2424import org .junit .Before ;
2525import org .junit .BeforeClass ;
26+ import org .slf4j .Logger ;
27+ import org .slf4j .LoggerFactory ;
2628
2729import soot .jimple .infoflow .AbstractInfoflow ;
2830import soot .jimple .infoflow .BackwardsInfoflow ;
4143 */
4244public abstract class JUnitTests extends AbstractJUnitTests {
4345
46+ protected static final Logger logger = LoggerFactory .getLogger (JUnitTests .class );
47+
4448 protected static String appPath , libPath ;
4549
4650 protected static List <String > sinks ;
@@ -206,12 +210,19 @@ protected void onlyForwards(IInfoflow infoflow, String message) {
206210 * @throws IOException
207211 */
208212 public static File getInfoflowRoot (Class <?> referenceClass ) throws IOException {
209- File f = new File (referenceClass .getProtectionDomain ().getCodeSource ().getLocation ().getPath ());
213+ File classFile = new File (referenceClass .getProtectionDomain ().getCodeSource ().getLocation ().getPath ());
214+ File f = classFile ;
210215 if (f .exists ()) {
211216 while (!f .getName ().equals ("soot-infoflow" ) && f .getParentFile () != null )
212217 f = f .getParentFile ();
213- return f ;
214- }
218+
219+ // The project root must exist and must not be the file system root
220+ if (f .exists () && f .getParentFile () != null )
221+ return f ;
222+
223+ logger .warn ("Finding project root from class file {} failed" , classFile );
224+ } else
225+ logger .warn ("Class file {} does not exist" , classFile );
215226 return getInfoflowRoot ();
216227 }
217228
You can’t perform that action at this time.
0 commit comments