o applying brian's patch which makes this IT work with the new/old classworlds

git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@486153 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jason van Zyl 2006-12-12 14:12:24 +00:00
parent 066ef42901
commit 44dd974c00
1 changed files with 35 additions and 28 deletions

View File

@ -132,38 +132,45 @@ public class Enhance
{
ClassLoader sysClassLoader = Thread.currentThread().getContextClassLoader();
URL[] urls = null;
Field field;
try
if ( sysClassLoader instanceof URLClassLoader )
{
urls = ( (URLClassLoader) sysClassLoader ).getURLs();
}
else
{
Field field;
try
{
field = sysClassLoader.getClass().getDeclaredField( "realm" );
field.setAccessible( true );
ClassRealm realm = (ClassRealm) field.get( sysClassLoader );
field = sysClassLoader.getClass().getDeclaredField( "realm" );
field.setAccessible( true );
ClassRealm realm = (ClassRealm) field.get( sysClassLoader );
urls = realm.getConstituents();
urls = realm.getConstituents();
}
catch ( SecurityException e )
{
// TODO Auto-generated catch block
e.printStackTrace();
}
catch ( NoSuchFieldException e )
{
// TODO Auto-generated catch block
e.printStackTrace();
}
catch ( IllegalArgumentException e )
{
// TODO Auto-generated catch block
e.printStackTrace();
}
catch ( IllegalAccessException e )
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
catch ( SecurityException e )
{
// TODO Auto-generated catch block
e.printStackTrace();
}
catch ( NoSuchFieldException e )
{
// TODO Auto-generated catch block
e.printStackTrace();
}
catch ( IllegalArgumentException e )
{
// TODO Auto-generated catch block
e.printStackTrace();
}
catch ( IllegalAccessException e )
{
// TODO Auto-generated catch block
e.printStackTrace();
}
//URL[] urls = ( (URLClassLoader) sysClassLoader ).getURLs();
this.getLog().info( "Initial Classpath:" );
for ( int i = 0; i < urls.length; i++ )
{