Kaydet (Commit) 92a1757f authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Improve error reporting

üst 092d6d9d
...@@ -277,39 +277,35 @@ public class JavaLoader implements XImplementationLoader, ...@@ -277,39 +277,35 @@ public class JavaLoader implements XImplementationLoader,
// Normally a string must no be null. // Normally a string must no be null.
try { try {
if ( locationUrl != null ) { if ( locationUrl != null ) {
// 1.
clazz = RegistrationClassFinder.find( locationUrl ); clazz = RegistrationClassFinder.find( locationUrl );
} if (clazz == null) {
else { throw new CannotActivateFactoryException(
// 2. "Cannot activate jar " + locationUrl);
}
} else {
clazz = Class.forName( implementationName ); clazz = Class.forName( implementationName );
if (clazz == null) {
throw new CannotActivateFactoryException(
"Cannot find class " + implementationName);
}
} }
} }
catch (java.net.MalformedURLException e) { catch (java.net.MalformedURLException e) {
CannotActivateFactoryException cae = new CannotActivateFactoryException( CannotActivateFactoryException cae = new CannotActivateFactoryException(
"Can not activate factory because " + e.toString() ); "Can not activate factory because " + e );
cae.fillInStackTrace(); cae.initCause(e);
throw cae; throw cae;
} }
catch (java.io.IOException e) { catch (java.io.IOException e) {
CannotActivateFactoryException cae = new CannotActivateFactoryException( CannotActivateFactoryException cae = new CannotActivateFactoryException(
"Can not activate factory because " + e.toString() ); "Can not activate factory because " + e );
cae.fillInStackTrace(); cae.initCause(e);
throw cae; throw cae;
} }
catch (java.lang.ClassNotFoundException e) { catch (java.lang.ClassNotFoundException e) {
CannotActivateFactoryException cae = new CannotActivateFactoryException( CannotActivateFactoryException cae = new CannotActivateFactoryException(
"Can not activate factory because " + e.toString() ); "Can not activate factory because " + e );
cae.fillInStackTrace(); cae.initCause(e);
throw cae;
}
if (null == clazz)
{
CannotActivateFactoryException cae =
new CannotActivateFactoryException(
"Cannot determine activation class!" );
cae.fillInStackTrace();
throw cae; throw cae;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment