Skip to content

Commit 47f7adc

Browse files
committed
more exclusion of non-existing directories
1 parent e68558c commit 47f7adc

File tree

1 file changed

+20
-1
lines changed
  • soot-infoflow-summaries/test/soot/jimple/infoflow/test/methodSummary/junit

1 file changed

+20
-1
lines changed

soot-infoflow-summaries/test/soot/jimple/infoflow/test/methodSummary/junit/TestHelper.java

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,29 @@ public static void setUp() throws IOException {
5656
if (!(testSrc1.exists() || testSrc2.exists()))
5757
fail("Test aborted - none of the test sources are available");
5858

59-
appPath = testSrc1.getCanonicalPath() + sep + testSrc2.getCanonicalPath();
59+
StringBuilder appPathBuilder = new StringBuilder();
60+
appendWithSeparator(appPathBuilder, testSrc1);
61+
appendWithSeparator(appPathBuilder, testSrc2);
62+
appPath = appPathBuilder.toString();
63+
6064
libPath = System.getProperty("java.home") + File.separator + "lib" + File.separator + "rt.jar";
6165
}
6266

67+
/**
68+
* Appends the given path to the given {@link StringBuilder} if it exists
69+
*
70+
* @param sb The {@link StringBuilder} to which to append the path
71+
* @param f The path to append
72+
* @throws IOException
73+
*/
74+
private static void appendWithSeparator(StringBuilder sb, File f) throws IOException {
75+
if (f.exists()) {
76+
if (sb.length() > 0)
77+
sb.append(System.getProperty("path.separator"));
78+
sb.append(f.getCanonicalPath());
79+
}
80+
}
81+
6382
protected boolean containsFlow(Set<MethodFlow> flows, SourceSinkType sourceTyp, String[] sourceFields,
6483
SourceSinkType sinkTyp, String[] sinkFields) {
6584
return containsFlow(flows, sourceTyp, -1, sourceFields, sinkTyp, -1, sinkFields);

0 commit comments

Comments
 (0)