aboutsummaryrefslogtreecommitdiffstats
path: root/src/newt/classes/com/jogamp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2019-11-22 17:18:57 +0100
committerSven Gothel <[email protected]>2019-11-22 17:18:57 +0100
commit3dcfa24384078fca34ce3cc877649f7e2c2c084b (patch)
tree6f57a32b96c4118e0292335e948aec11d341a0b5 /src/newt/classes/com/jogamp
parent30826d978258c16b06cdab34e5a4265406545c3f (diff)
Bug 1156: NEWT: NewtFactory.getCustomClass(..) Robustness
getCustomClass(..) shall throw all required exceptions upstream. Previous essential NEWT driver exception information got suppressed if failing, only disclosed in debug mode.
Diffstat (limited to 'src/newt/classes/com/jogamp')
-rw-r--r--src/newt/classes/com/jogamp/newt/NewtFactory.java13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/newt/classes/com/jogamp/newt/NewtFactory.java b/src/newt/classes/com/jogamp/newt/NewtFactory.java
index dd15eb3ea..99ce16136 100644
--- a/src/newt/classes/com/jogamp/newt/NewtFactory.java
+++ b/src/newt/classes/com/jogamp/newt/NewtFactory.java
@@ -43,6 +43,7 @@ import com.jogamp.nativewindow.AbstractGraphicsDevice;
import com.jogamp.nativewindow.AbstractGraphicsScreen;
import com.jogamp.nativewindow.CapabilitiesImmutable;
import com.jogamp.nativewindow.NativeWindow;
+import com.jogamp.nativewindow.NativeWindowException;
import com.jogamp.nativewindow.NativeWindowFactory;
import com.jogamp.common.util.IOUtil;
@@ -100,8 +101,8 @@ public class NewtFactory {
public static Class<?> getCustomClass(final String packageName, final String classBaseName) {
Class<?> clazz = null;
+ final String clazzName;
if(packageName!=null && classBaseName!=null) {
- final String clazzName;
if( packageName.startsWith(".") ) {
clazzName = DRIVER_DEFAULT_ROOT_PACKAGE + packageName + "." + classBaseName ;
} else {
@@ -110,11 +111,13 @@ public class NewtFactory {
try {
clazz = Class.forName(clazzName);
} catch (final Throwable t) {
- if(DEBUG_IMPLEMENTATION) {
- System.err.println("Warning: Failed to find class <"+clazzName+">: "+t.getMessage());
- t.printStackTrace();
- }
+ throw new NativeWindowException("Failed to find or initialize class <"+packageName+"."+classBaseName+"> -> <"+clazzName+">: "+t.getMessage(), t);
}
+ } else {
+ clazzName = null;
+ }
+ if( null == clazz ) {
+ throw new NativeWindowException("Failed to determine class <"+packageName+"."+classBaseName+"> -> <"+clazzName+">");
}
return clazz;
}