@@ -299,7 +299,6 @@ public void setSootOptions(Options options, InfoflowConfiguration config) {
299299
300300 @ BeforeClass
301301 public static void setUp () throws IOException {
302- final String sep = System .getProperty ("path.separator" );
303302 File f = new File ("." );
304303 File testSrc1 = new File (f , "bin" );
305304 File testSrc2 = new File (f , "testBin" );
@@ -310,9 +309,29 @@ public static void setUp() throws IOException {
310309 fail ("Test aborted - none of the test sources are available" );
311310 }
312311
313- appPath = testSrc1 .getCanonicalPath () + sep + testSrc2 .getCanonicalPath () + sep + testSrc3 .getCanonicalPath ()
314- + sep + testSrc4 .getCanonicalPath ();
312+ StringBuilder appPathBuilder = new StringBuilder ();
313+ appendWithSeparator (appPathBuilder , testSrc1 );
314+ appendWithSeparator (appPathBuilder , testSrc2 );
315+ appendWithSeparator (appPathBuilder , testSrc3 );
316+ appendWithSeparator (appPathBuilder , testSrc4 );
317+ appPath = appPathBuilder .toString ();
318+
315319 libPath = System .getProperty ("java.home" ) + File .separator + "lib" + File .separator + "rt.jar" ;
316320 }
317321
322+ /**
323+ * Appends the given path to the given {@link StringBuilder} if it exists
324+ *
325+ * @param sb The {@link StringBuilder} to which to append the path
326+ * @param f The path to append
327+ * @throws IOException
328+ */
329+ private static void appendWithSeparator (StringBuilder sb , File f ) throws IOException {
330+ if (f .exists ()) {
331+ if (sb .length () > 0 )
332+ sb .append (System .getProperty ("path.separator" ));
333+ sb .append (f .getCanonicalPath ());
334+ }
335+ }
336+
318337}
0 commit comments