Buggy code:
setProperty ( Launcher . ANTHOME_PROPERTY , antHome . getAbsolutePath ( ) ) ; } if ( ! ( antHome . exists ( ) ) ) { throw new LaunchException ( ( ( ( "Ant<seq2seq4repair_space>home<seq2seq4repair_space>is<seq2seq4repair_space>set<seq2seq4repair_space>incorrectly<seq2seq4repair_space>or<seq2seq4repair_space>" + "ant<seq2seq4repair_space>could<seq2seq4repair_space>not<seq2seq4repair_space>be<seq2seq4repair_space>located<seq2seq4repair_space>(estimated<seq2seq4repair_space>value=" ) + ( antHome . getAbsolutePath ( ) ) ) + ")" ) ) ; } List libPaths = new ArrayList ( ) ; String cpString = null ; List argList = new ArrayList ( ) ; String [ ] newArgs ; boolean noUserLib = false ; boolean noClassPath = false ; for ( int i = 0 ; i < ( args . length ) ; ++ i ) { if ( args [ i ] . equals ( "-lib" ) ) { if ( i == ( ( args . length ) - 1 ) ) { throw new LaunchException ( ( "The<seq2seq4repair_space>-lib<seq2seq4repair_space>argument<seq2seq4repair_space>must<seq2seq4repair_space>" + "be<seq2seq4repair_space>followed<seq2seq4repair_space>by<seq2seq4repair_space>a<seq2seq4repair_space>library<seq2seq4repair_space>location" ) ) ; } libPaths . add ( args [ ( ++ i ) ] ) ; } else if ( args [ i ] . equals ( "-cp" ) ) { if ( i == ( ( args . length ) - 1 ) ) { throw new LaunchException ( ( "The<seq2seq4repair_space>-cp<seq2seq4repair_space>argument<seq2seq4repair_space>must<seq2seq4repair_space>" + "be<seq2seq4repair_space>followed<seq2seq4repair_space>by<seq2seq4repair_space>a<seq2seq4repair_space>classpath<seq2seq4repair_space>expression" ) ) ; } if ( cpString != null ) { throw new LaunchException ( ( "The<seq2seq4repair_space>-cp<seq2seq4repair_space>argument<seq2seq4repair_space>must<seq2seq4repair_space>" + "not<seq2seq4repair_space>be<seq2seq4repair_space>repeated" ) ) ; } cpString = args [ ( ++ i ) ] ; } else if ( ( args [ i ] . equals ( "--nouserlib" ) ) || ( args [ i ] . equals ( "-nouserlib" ) ) ) { noUserLib = true ; } else if ( args [ i ] . equals ( "--launchdiag" ) ) { Launcher . launchDiag = true ; } else if ( ( args [ i ] . equals ( "--noclasspath" ) ) || ( args [ i ] . equals ( "-noclasspath" ) ) ) { noClassPath = true ; } else if ( args [ i ] . equals ( "-main" ) ) { if ( i == ( ( args . length ) - 1 ) ) { throw new LaunchException ( ( "The<seq2seq4repair_space>-main<seq2seq4repair_space>argument<seq2seq4repair_space>must<seq2seq4repair_space>" + "be<seq2seq4repair_space>followed<seq2seq4repair_space>by<seq2seq4repair_space>a<seq2seq4repair_space>library<seq2seq4repair_space>location" ) ) ; } mainClassname = args [ ( ++ i ) ] ; } else { argList . add ( args [ i ] ) ; } } logPath ( "Launcher<seq2seq4repair_space>JAR" , sourceJar ) ; logPath ( "Launcher<seq2seq4repair_space>JAR<seq2seq4repair_space>directory" , sourceJar . getParentFile ( ) ) ; logPath ( "java.home" , new File ( System . getProperty ( "java.home" ) ) ) ; if ( ( argList . size ( ) ) == ( args . length ) ) { newArgs = args ; } else { newArgs = ( ( String [ ] ) ( argList . toArray ( new String [ argList . size ( ) ] ) ) ) ; } URL [ ] libURLs = getLibPathURLs ( ( noClassPath ? null : cpString ) , libPaths ) ; URL [ ] systemURLs = getSystemURLs ( jarDir ) ; URL [ ] userURLs = ( noUserLib ) ? new URL [ 0 ] : getUserURLs ( ) ; File toolsJAR = Locator . getToolsJar ( ) ; logPath ( "tools.jar" , toolsJAR ) ; URL [ ] jars = getJarArray ( libURLs , userURLs , systemURLs , toolsJAR ) ; StringBuffer baseClassPath = new StringBuffer ( System . getProperty ( Launcher . JAVA_CLASS_PATH ) ) ; if ( ( baseClassPath . charAt ( ( ( baseClassPath . length ( ) ) - 1 ) ) ) == ( File . pathSeparatorChar ) ) { baseClassPath . setLength ( ( ( baseClassPath . length ( ) ) - 1 ) ) ; } for ( int i = 0 ; i < ( jars . length ) ; ++ i ) { baseClassPath . append ( File . pathSeparatorChar ) ; baseClassPath . append ( Locator . fromURI ( jars [ i ] . toString ( ) ) ) ; } setProperty ( Launcher . JAVA_CLASS_PATH , baseClassPath . toString ( ) ) ; <START_BUG> URLClassLoader loader = new URLClassLoader ( jars ) ; <END_BUG> Thread . currentThread ( ) . setContextClassLoader ( loader ) ; Class mainClass = null ; int exitCode = 0 ; Throwable thrown = null ; try { mainClass = loader . loadClass ( mainClassname ) ; AntMain main = ( ( AntMain ) ( mainClass . newInstance ( ) ) ) ; main . startAnt ( newArgs , null , null ) ; } catch ( InstantiationException ex ) { System . err . println ( ( ( "Incompatible<seq2seq4repair_space>version<seq2seq4repair_space>of<seq2seq4repair_space>" + mainClassname ) + "<seq2seq4repair_space>detected" ) ) ; File mainJar = Locator . getClassSource ( mainClass ) ; System . err . println ( ( "Location<seq2seq4repair_space>of<seq2seq4repair_space>this<seq2seq4repair_space>class<seq2seq4repair_space>" + mainJar ) ) ; thrown = ex ; } catch ( ClassNotFoundException cnfe ) { System . err . println ( ( "Failed<seq2seq4repair_space>to<seq2seq4repair_space>locate" + mainClassname ) ) ; thrown = cnfe ; } catch ( Throwable t ) { t . printStackTrace ( System . err ) ; thrown = t ; } if ( thrown != null ) { System . err . println ( ( ( ( Launcher . ANTHOME_PROPERTY ) + ":<seq2seq4repair_space>" ) + ( antHome . getAbsolutePath ( ) ) ) ) ; System . err . println ( ( "Classpath:<seq2seq4repair_space>" + ( baseClassPath . toString ( ) ) ) ) ; System . err . println ( ( "Launcher<seq2seq4repair_space>JAR:<seq2seq4repair_space>" + ( sourceJar . getAbsolutePath ( ) ) ) ) ; System . err . println ( ( "Launcher<seq2seq4repair_space>Directory:<seq2seq4repair_space>" + ( jarDir . getAbsolutePath ( ) ) ) ) ; exitCode = Launcher . EXIT_CODE_ERROR ; } return exitCode ; } private URL [ ] getLibPathURLs ( String cpString , List libPaths ) throws MalformedURLException { } private URL [ ] getSystemURLs ( File antLauncherDir ) throws MalformedURLException { }

Fix:
URLClassLoader loader = new URLClassLoader ( jars , Launcher . class . getClassLoader ( ) ) ;