Parcourir la source

Make LogUtils try some more ctors.

NoClassDefFoundError only takes a message (no source). Try
throwable-only and message-only ctors in addition to the
two-arg ctors.
pull/697/head
Chris Smith il y a 8 ans
Parent
révision
6c4b7ffc41
1 fichiers modifiés avec 11 ajouts et 1 suppressions
  1. 11
    1
      src/main/java/com/dmdirc/util/LogUtils.java

+ 11
- 1
src/main/java/com/dmdirc/util/LogUtils.java Voir le fichier

133
             }
133
             }
134
 
134
 
135
             if (throwable == null) {
135
             if (throwable == null) {
136
-                throw new ReflectiveOperationException("Unable to find ctor of " + clazz);
136
+                try {
137
+                    // Or maybe just a throwable?
138
+                    throwable = clazz.getConstructor(Throwable.class).newInstance(getThrowable(proxy.getCause()));
139
+                } catch (NoSuchMethodException ex) {
140
+                    try {
141
+                        throwable = clazz.getConstructor(String.class).newInstance(proxy.getMessage());
142
+                    } catch (NoSuchMethodException ex2) {
143
+                        // *Shrug*
144
+                        throw new ReflectiveOperationException("Unable to find ctor of " + clazz);
145
+                    }
146
+                }
137
             }
147
             }
138
         }
148
         }
139
         throwable.setStackTrace(getStackTraceElements(proxy.getStackTraceElementProxyArray()));
149
         throwable.setStackTrace(getStackTraceElements(proxy.getStackTraceElementProxyArray()));

Chargement…
Annuler
Enregistrer