diff options
Diffstat (limited to 'src/junit/com/jogamp/test')
-rwxr-xr-x | src/junit/com/jogamp/test/junit/jogl/offscreen/WindowUtilNEWT.java | 8 | ||||
-rw-r--r-- | src/junit/com/jogamp/test/junit/util/MiscUtils.java | 5 |
2 files changed, 6 insertions, 7 deletions
diff --git a/src/junit/com/jogamp/test/junit/jogl/offscreen/WindowUtilNEWT.java b/src/junit/com/jogamp/test/junit/jogl/offscreen/WindowUtilNEWT.java index 1a0553ded..55ad83d25 100755 --- a/src/junit/com/jogamp/test/junit/jogl/offscreen/WindowUtilNEWT.java +++ b/src/junit/com/jogamp/test/junit/jogl/offscreen/WindowUtilNEWT.java @@ -55,11 +55,11 @@ public class WindowUtilNEWT { Assert.assertNotNull(demo); Assert.assertNotNull(window); if(debug) { - MiscUtils.setField(demo, "glDebug", true); - MiscUtils.setField(demo, "glTrace", true); + MiscUtils.setFieldIfExists(demo, "glDebug", true); + MiscUtils.setFieldIfExists(demo, "glTrace", true); } - if(!MiscUtils.setField(demo, "window", window)) { - MiscUtils.setField(demo, "glWindow", glWindow); + if(!MiscUtils.setFieldIfExists(demo, "window", window)) { + MiscUtils.setFieldIfExists(demo, "glWindow", glWindow); } } diff --git a/src/junit/com/jogamp/test/junit/util/MiscUtils.java b/src/junit/com/jogamp/test/junit/util/MiscUtils.java index 8e53d9255..d28d0e7cb 100644 --- a/src/junit/com/jogamp/test/junit/util/MiscUtils.java +++ b/src/junit/com/jogamp/test/junit/util/MiscUtils.java @@ -40,13 +40,12 @@ public class MiscUtils { try { return Integer.parseInt(str); } catch (Exception ex) { - // FIXME ex.printStackTrace(); } return def; } - public static boolean setField(Object instance, String fieldName, Object value) { + public static boolean setFieldIfExists(Object instance, String fieldName, Object value) { try { Field f = instance.getClass().getField(fieldName); if(value instanceof Boolean || f.getType().isInstance(value)) { @@ -58,7 +57,7 @@ public class MiscUtils { } catch (IllegalAccessException ex) { throw new RuntimeException(ex); } catch (NoSuchFieldException nsfe) { - throw new RuntimeException(instance.getClass()+" has no '"+fieldName+"' field", nsfe); + // OK - throw new RuntimeException(instance.getClass()+" has no '"+fieldName+"' field", nsfe); } return false; } |