@@ -57,7 +57,6 @@ public abstract class JUnitTests {
5757
5858 @ BeforeClass
5959 public static void setUp () throws IOException {
60- final String sep = System .getProperty ("path.separator" );
6160 File f = new File ("." );
6261 File testSrc1 = new File (f , "bin" );
6362 File testSrc4 = new File (f , "testBin" );
@@ -70,8 +69,14 @@ public static void setUp() throws IOException {
7069 fail ("Test aborted - none of the test sources are available" );
7170 }
7271
73- appPath = testSrc1 .getCanonicalPath () + sep + testSrc2 .getCanonicalPath () + sep + testSrc3 .getCanonicalPath ()
74- + sep + testSrc4 .getCanonicalPath () + sep + testSrc5 .getCanonicalPath ();
72+ StringBuilder appPathBuilder = new StringBuilder ();
73+ appendWithSeparator (appPathBuilder , testSrc1 );
74+ appendWithSeparator (appPathBuilder , testSrc2 );
75+ appendWithSeparator (appPathBuilder , testSrc3 );
76+ appendWithSeparator (appPathBuilder , testSrc4 );
77+ appendWithSeparator (appPathBuilder , testSrc5 );
78+ appPath = appPathBuilder .toString ();
79+
7580 libPath = System .getProperty ("java.home" ) + File .separator + "lib" + File .separator + "rt.jar" ;
7681
7782 sources = new ArrayList <String >();
@@ -90,6 +95,21 @@ public static void setUp() throws IOException {
9095 sinks .add (sinkDouble );
9196 }
9297
98+ /**
99+ * Appends the given path to the given {@link StringBuilder} if it exists
100+ *
101+ * @param sb The {@link StringBuilder} to which to append the path
102+ * @param f The path to append
103+ * @throws IOException
104+ */
105+ private static void appendWithSeparator (StringBuilder sb , File f ) throws IOException {
106+ if (f .exists ()) {
107+ if (sb .length () > 0 )
108+ sb .append (System .getProperty ("path.separator" ));
109+ sb .append (f .getCanonicalPath ());
110+ }
111+ }
112+
93113 @ Before
94114 public void resetSootAndStream () throws IOException {
95115 soot .G .reset ();
0 commit comments