jurt/com/sun/star/comp/loader/JavaLoader.java |   34 +++++++++++---------------
 1 file changed, 15 insertions(+), 19 deletions(-)

New commits:
commit 92a1757fa523bd15412ca1195807ac41205e9438
Author: Stephan Bergmann <sberg...@redhat.com>
Date:   Tue Mar 20 18:35:24 2012 +0100

    Improve error reporting

diff --git a/jurt/com/sun/star/comp/loader/JavaLoader.java 
b/jurt/com/sun/star/comp/loader/JavaLoader.java
index 25fc90b..113e763 100644
--- a/jurt/com/sun/star/comp/loader/JavaLoader.java
+++ b/jurt/com/sun/star/comp/loader/JavaLoader.java
@@ -277,39 +277,35 @@ public class JavaLoader implements XImplementationLoader,
         //    Normally a string must no be null.
         try {
             if ( locationUrl != null ) {
-                // 1.
                 clazz = RegistrationClassFinder.find( locationUrl );
-            }
-            else {
-                // 2.
+                if (clazz == null) {
+                    throw new CannotActivateFactoryException(
+                        "Cannot activate jar " + locationUrl);
+                }
+            } else {
                 clazz = Class.forName( implementationName );
+                if (clazz == null) {
+                    throw new CannotActivateFactoryException(
+                        "Cannot find class " + implementationName);
+                }
             }
         }
         catch (java.net.MalformedURLException e) {
             CannotActivateFactoryException cae = new 
CannotActivateFactoryException(
-                    "Can not activate factory because " + e.toString() );
-            cae.fillInStackTrace();
+                    "Can not activate factory because " + e );
+            cae.initCause(e);
             throw cae;
         }
         catch (java.io.IOException e) {
             CannotActivateFactoryException cae = new 
CannotActivateFactoryException(
-                    "Can not activate factory because " + e.toString() );
-            cae.fillInStackTrace();
+                    "Can not activate factory because " + e );
+            cae.initCause(e);
             throw cae;
         }
         catch (java.lang.ClassNotFoundException e) {
             CannotActivateFactoryException cae = new 
CannotActivateFactoryException(
-                    "Can not activate factory because " + e.toString() );
-            cae.fillInStackTrace();
-            throw cae;
-        }
-
-        if (null == clazz)
-        {
-            CannotActivateFactoryException cae =
-                new CannotActivateFactoryException(
-                    "Cannot determine activation class!" );
-            cae.fillInStackTrace();
+                    "Can not activate factory because " + e );
+            cae.initCause(e);
             throw cae;
         }
 
_______________________________________________
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to