diff options
Diffstat (limited to 'src/newt/classes')
-rw-r--r-- | src/newt/classes/jogamp/newt/DisplayImpl.java | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/src/newt/classes/jogamp/newt/DisplayImpl.java b/src/newt/classes/jogamp/newt/DisplayImpl.java index c1cd6db32..61a39c133 100644 --- a/src/newt/classes/jogamp/newt/DisplayImpl.java +++ b/src/newt/classes/jogamp/newt/DisplayImpl.java @@ -118,6 +118,8 @@ public abstract class DisplayImpl extends Display { return null; } final PointerIconImpl[] res = { null }; + final Exception[] ex = { null }; + final String exStr = "Could not resolve "+pngResource.resourcePaths[0]; runOnEDTIfAvail(true, new Runnable() { public void run() { try { @@ -126,7 +128,7 @@ public abstract class DisplayImpl extends Display { } final URLConnection urlConn = pngResource.resolve(0); if( null == urlConn ) { - throw new IOException("Could not resolve "+pngResource.resourcePaths[0]); + throw new IOException(exStr); } final PNGPixelRect image = PNGPixelRect.read(urlConn.getInputStream(), getNativePointerIconPixelFormat(), @@ -138,20 +140,32 @@ public abstract class DisplayImpl extends Display { if( DEBUG_POINTER_ICON ) { System.err.println("createPointerIconPNG.0: "+image+", handle: "+toHexString(handle)+", hot "+hotspot); } - if( 0 != handle ) { - res[0] = new PointerIconImpl(DisplayImpl.this, image, hotspot, handle); - if( DEBUG_POINTER_ICON ) { - System.err.println("createPointerIconPNG.0: "+res[0]); - } + if( 0 == handle ) { + throw new IOException(exStr); + } + res[0] = new PointerIconImpl(DisplayImpl.this, image, hotspot, handle); + if( DEBUG_POINTER_ICON ) { + System.err.println("createPointerIconPNG.0: "+res[0]); } } catch (final Exception e) { - e.printStackTrace(); + ex[0] = e; } } } ); - if( null != res[0] ) { - synchronized(pointerIconList) { - pointerIconList.add(res[0]); + if( null != ex[0] ) { + final Exception e = ex[0]; + if( e instanceof IllegalArgumentException) { + throw new IllegalArgumentException(e); + } + if( e instanceof IllegalStateException) { + throw new IllegalStateException(e); } + throw new IOException(e); + } + if( null == res[0] ) { + throw new IOException(exStr); + } + synchronized(pointerIconList) { + pointerIconList.add(res[0]); } return res[0]; } |