From 3dcfa24384078fca34ce3cc877649f7e2c2c084b Mon Sep 17 00:00:00 2001
From: Sven Gothel <sgothel@jausoft.com>
Date: Fri, 22 Nov 2019 17:18:57 +0100
Subject: 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.
---
 src/newt/classes/jogamp/newt/DisplayImpl.java | 6 +-----
 src/newt/classes/jogamp/newt/ScreenImpl.java  | 6 +-----
 src/newt/classes/jogamp/newt/WindowImpl.java  | 6 +-----
 3 files changed, 3 insertions(+), 15 deletions(-)

(limited to 'src/newt/classes/jogamp')

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) {
-- 
cgit v1.2.3