diff options
-rw-r--r-- | src/newt/classes/com/jogamp/newt/NewtFactory.java | 13 | ||||
-rw-r--r-- | src/newt/classes/jogamp/newt/DisplayImpl.java | 6 | ||||
-rw-r--r-- | src/newt/classes/jogamp/newt/ScreenImpl.java | 6 | ||||
-rw-r--r-- | src/newt/classes/jogamp/newt/WindowImpl.java | 6 |
4 files changed, 11 insertions, 20 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; } diff --git a/src/newt/classes/jogamp/newt/DisplayImpl.java b/src/newt/classes/jogamp/newt/DisplayImpl.java index 61a39c133..8037ffdce 100644 --- a/src/newt/classes/jogamp/newt/DisplayImpl.java +++ b/src/newt/classes/jogamp/newt/DisplayImpl.java @@ -272,11 +272,7 @@ public abstract class DisplayImpl extends Display { private static Class<?> getDisplayClass(final String type) throws ClassNotFoundException { - final Class<?> displayClass = NewtFactory.getCustomClass(type, "DisplayDriver"); - if(null==displayClass) { - throw new ClassNotFoundException("Failed to find NEWT Display Class <"+type+".DisplayDriver>"); - } - return displayClass; + return NewtFactory.getCustomClass(type, "DisplayDriver"); } /** Make sure to reuse a Display with the same name */ diff --git a/src/newt/classes/jogamp/newt/ScreenImpl.java b/src/newt/classes/jogamp/newt/ScreenImpl.java index 347ea650e..00bba64df 100644 --- a/src/newt/classes/jogamp/newt/ScreenImpl.java +++ b/src/newt/classes/jogamp/newt/ScreenImpl.java @@ -92,11 +92,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { private static Class<?> getScreenClass(final String type) throws ClassNotFoundException { - final Class<?> screenClass = NewtFactory.getCustomClass(type, "ScreenDriver"); - if(null==screenClass) { - throw new ClassNotFoundException("Failed to find NEWT Screen Class <"+type+".ScreenDriver>"); - } - return screenClass; + return NewtFactory.getCustomClass(type, "ScreenDriver"); } public static Screen create(final Display display, int idx) { diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java index 0f30f9458..47047f2b0 100644 --- a/src/newt/classes/jogamp/newt/WindowImpl.java +++ b/src/newt/classes/jogamp/newt/WindowImpl.java @@ -578,11 +578,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer private static Class<?> getWindowClass(final String type) throws ClassNotFoundException { - final Class<?> windowClass = NewtFactory.getCustomClass(type, "WindowDriver"); - if(null==windowClass) { - throw new ClassNotFoundException("Failed to find NEWT Window Class <"+type+".WindowDriver>"); - } - return windowClass; + return NewtFactory.getCustomClass(type, "WindowDriver"); } public static WindowImpl create(final NativeWindow parentWindow, final long parentWindowHandle, final Screen screen, final CapabilitiesImmutable caps) { |