diff options
author | Sven Gothel <[email protected]> | 2015-10-03 05:07:46 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2015-10-03 05:07:46 +0200 |
commit | 731c473740e3e7ccd26ecda7ea0200382795c3a6 (patch) | |
tree | 7a363f30e85affaaea0d588abbc6087b3b582d28 | |
parent | 670df25aae92079945a83401db9722d543730193 (diff) |
Bug 1237: Adopt GlueGen's clarification of IOUtil.getResource(..), commit d78bb1be0a6290cb94918b21865a023c01825048
- Skip relative lookup for IOUtil.ClassResources using 'asset' only (from JAR file)
- Tested w/ jar file and build-dir, see scripts/tests.sh 'USE_BUILDDIR'
28 files changed, 102 insertions, 94 deletions
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh index 65d9bf3a0..691a6a2e5 100644 --- a/make/scripts/tests.sh +++ b/make/scripts/tests.sh @@ -42,9 +42,13 @@ if [ $MOSX -eq 1 ] ; then MOSX_MT=1 fi -# We use TempJarCache per default now! -#export LD_LIBRARY_PATH=$JOGAMP_LD_LIBRARY_PATH -#export DYLD_LIBRARY_PATH=$JOGAMP_DYLD_LIBRARY_PATH +# We use TempJarCache and JAR files per default now! +# export USE_BUILDDIR=1 + +if [ $USE_BUILDDIR -eq 1 ] ; then + export LD_LIBRARY_PATH=$JOGAMP_LD_LIBRARY_PATH + export DYLD_LIBRARY_PATH=$JOGAMP_DYLD_LIBRARY_PATH +fi #export LD_LIBRARY_PATH=$spath/../../EXTERNAL/PVRVFrame/OGLES-2.0/Linux_x86_64:$LD_LIBRARY_PATH #export LD_LIBRARY_PATH=$spath/../../EXTERNAL/PVRVFrame/OGLES-2.0/Linux_x86_32:$LD_LIBRARY_PATH @@ -279,7 +283,7 @@ function jrun() { #D_ARGS="-Djogl.debug.graph.curve.instance" #D_ARGS="-Djogl.debug.graph.curve -Djogl.debug.GLSLCode -Djogl.debug.TraceGL" #D_ARGS="-Djogl.debug.graph.curve -Djogl.debug.GLSLState" - #D_ARGS="-Djogamp.debug.IOUtil" + D_ARGS="-Djogamp.debug.IOUtil" #D_ARGS="-Djogamp.debug.TempJarCache -Djogamp.debug.JarUtil -Djogamp.debug.IOUtil" #D_ARGS="-Djogamp.debug.JNILibLoader -Djogamp.debug.TempJarCache -Djogamp.debug.JarUtil -Djogamp.debug.IOUtil" #D_ARGS="-Djogamp.debug.JNILibLoader -Djogamp.debug.TempFileCache -Djogamp.debug.TempJarCache -Djogamp.debug.JarUtil" @@ -310,7 +314,7 @@ function jrun() { #D_ARGS="-Djogl.debug.AudioSink -Djoal.openal.lib=system" #D_ARGS="-Djogl.debug.AudioSink -Djogl.debug.AudioSink.trace" #D_ARGS="-Djogl.debug.AudioSink -Djogl.debug.GLMediaPlayer" - D_ARGS="-Djogl.debug.GLMediaPlayer -Djogl.debug.GLMediaPlayer.Native" + #D_ARGS="-Djogl.debug.GLMediaPlayer -Djogl.debug.GLMediaPlayer.Native" #D_ARGS="-Djogl.debug.GLMediaPlayer -Djogl.debug.GLSLCode" #D_ARGS="-Djogl.debug.GLMediaPlayer.StreamWorker.delay=25 -Djogl.debug.GLMediaPlayer" #D_ARGS="-Djogl.debug.GLMediaPlayer.Native" @@ -334,9 +338,14 @@ function jrun() { #export USE_CLASSPATH=$JOGAMP_ALL_AWT_CLASSPATH export USE_CLASSPATH=$JOGAMP_ALL_NOAWT_CLASSPATH #export USE_CLASSPATH=$JOGAMP_MOBILE_CLASSPATH - #export USE_CLASSPATH=.:$GLUEGEN_JAR:$JOGL_BUILD_DIR/jar/atomic/jogl.jar:$JOGL_BUILD_DIR/jar/atomic/jogl-gldesktop.jar:$JOGL_BUILD_DIR/jar/atomic/jogl-os-x11.jar:$JOGL_BUILD_DIR/jar/atomic/jogl-util.jar:$JOGL_BUILD_DIR/jar/atomic/nativewindow.jar:$JOGL_BUILD_DIR/jar/atomic/nativewindow-os-x11.jar:$JOGL_BUILD_DIR/jar/atomic/newt.jar:$JOGL_BUILD_DIR/jar/atomic/newt-driver-x11.jar:$JOGL_BUILD_DIR/jar/atomic/newt-ogl.jar:$JOGL_BUILD_DIR/jar/jogl-test.jar:$SWT_CLASSPATH:$JUNIT_JAR:$ANT_JARS + #export USE_CLASSPATH=.:$GLUEGEN_JAR:$JOGL_BUILDDIR/jar/atomic/jogl.jar:$JOGL_BUILDDIR/jar/atomic/jogl-gldesktop.jar:$JOGL_BUILDDIR/jar/atomic/jogl-os-x11.jar:$JOGL_BUILDDIR/jar/atomic/jogl-util.jar:$JOGL_BUILDDIR/jar/atomic/nativewindow.jar:$JOGL_BUILDDIR/jar/atomic/nativewindow-os-x11.jar:$JOGL_BUILDDIR/jar/atomic/newt.jar:$JOGL_BUILDDIR/jar/atomic/newt-driver-x11.jar:$JOGL_BUILDDIR/jar/atomic/newt-ogl.jar:$JOGL_BUILDDIR/jar/jogl-test.jar:$JUNIT_JAR:$ANT_JARS X_ARGS="-Djava.awt.headless=true $X_ARGS" fi + + if [ $USE_BUILDDIR -eq 1 ] ; then + export USE_CLASSPATH=.:$GLUEGEN_BUILDDIR/classes:$GLUEGEN_BUILDDIR/test/build/classes:$JOAL_BUILDDIR/classes:$JOGL_BUILDDIR/nativewindow/classes:$JOGL_BUILDDIR/jogl/classes:$JOGL_BUILDDIR/newt/classes:$JOGL_BUILDDIR/oculusvr/classes:$JOGL_BUILDDIR/test/build/classes:$JUNIT_JAR:$ANT_JARS + fi + if [ $swton -eq 1 ] ; then export USE_CLASSPATH=$USE_CLASSPATH:$JOGL_SWT_CLASSPATH fi @@ -344,8 +353,9 @@ function jrun() { export USE_CLASSPATH=$CUSTOM_CLASSPATH:$USE_CLASSPATH fi #Test NEWT Broadcom .. - #export USE_CLASSPATH=$JOGL_BUILD_DIR/jar/atomic/newt.driver.broadcomegl.jar::$USE_CLASSPATH + #export USE_CLASSPATH=$JOGL_BUILDDIR/jar/atomic/newt.driver.broadcomegl.jar::$USE_CLASSPATH #X_ARGS="-Dnativewindow.ws.name=jogamp.newt.driver.broadcom.egl $X_ARGS" + echo USE_BUILDDIR $USE_BUILDDIR echo USE_CLASSPATH $USE_CLASSPATH if [ $MOSX_MT -eq 1 ] ; then if [ $awton -eq 0 -a $swton -eq 0 ] ; then @@ -424,7 +434,7 @@ function testawtswt() { # # HiDPI # -testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $* +#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2SimpleNEWT $* #testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelAWT $* #testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2AWT $* @@ -864,7 +874,7 @@ testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $* #testnoawt com.jogamp.opengl.test.junit.graph.demos.ui.UINewtDemo01 $* #testnoawt com.jogamp.opengl.test.junit.graph.demos.GPUTextNewtDemo $* #testnoawt com.jogamp.opengl.test.junit.graph.demos.GPURegionNewtDemo $* -#testnoawt com.jogamp.opengl.test.junit.graph.demos.GPUUISceneNewtDemo $* +testnoawt com.jogamp.opengl.test.junit.graph.demos.GPUUISceneNewtDemo $* #testawt com.jogamp.opengl.test.junit.graph.demos.GPUUISceneNewtCanvasAWTDemo $* #testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieCube $* diff --git a/src/jogl/classes/com/jogamp/graph/font/FontFactory.java b/src/jogl/classes/com/jogamp/graph/font/FontFactory.java index be16e030f..76badcda8 100644 --- a/src/jogl/classes/com/jogamp/graph/font/FontFactory.java +++ b/src/jogl/classes/com/jogamp/graph/font/FontFactory.java @@ -199,7 +199,7 @@ public class FontFactory { throw new IOException(e); } } else { - stream = IOUtil.getResource(context, fname).getInputStream(); + stream = IOUtil.getResource(fname, context.getClassLoader(), context).getInputStream(); } if( null != stream ) { return FontFactory.get ( stream, true ) ; diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java index e5ef3b268..173c394ba 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java +++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java @@ -1106,7 +1106,7 @@ public class ShaderCode { nextConn = IOUtil.openURL(relUri.toURL(), "ShaderCode.relativeOf "); if (nextConn == null) { // Try relative of class and absolute - nextConn = IOUtil.getResource(context, includeFile); + nextConn = IOUtil.getResource(includeFile, context.getClassLoader(), context); } if (nextConn == null) { // Fail @@ -1158,7 +1158,7 @@ public class ShaderCode { * @see IOUtil#getResource(Class, String) */ public static CharSequence readShaderSource(final Class<?> context, final String path, final boolean mutableStringBuilder) throws IOException { - final URLConnection conn = IOUtil.getResource(context, path); + final URLConnection conn = IOUtil.getResource(path, context.getClassLoader(), context); if (conn == null) { return null; } @@ -1204,7 +1204,7 @@ public class ShaderCode { * @see IOUtil#getResource(Class, String) */ public static ByteBuffer readShaderBinary(final Class<?> context, final String path) throws IOException { - final URLConnection conn = IOUtil.getResource(context, path); + final URLConnection conn = IOUtil.getResource(path, context.getClassLoader(), context); if (conn == null) { return null; } diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShader.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShader.java index f5dec1cab..376afb8ce 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShader.java +++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShader.java @@ -52,7 +52,7 @@ public abstract class CompileShader { final String justName = basename(resourceName); outName = justName.substring(0, justName.length() - suffixLen) + ShaderCode.getFileSuffix(true, type); - final URL resourceURL = IOUtil.getResource(null, resourceName).getURL(); + final URL resourceURL = IOUtil.getResource(resourceName, this.getClass().getClassLoader(), null).getURL(); final String dirName = dirname(resourceURL.getPath()); outName = dirName + File.separator + "bin" + File.separator + @@ -64,7 +64,7 @@ public abstract class CompileShader { public void processOneShader(final String resourceName, final String outName, final int type) throws IOException, UnsupportedEncodingException, InterruptedException { - final URL resourceURL = IOUtil.getResource(null, resourceName).getURL(); + final URL resourceURL = IOUtil.getResource(resourceName, this.getClass().getClassLoader(), null).getURL(); final String dirName = dirname(resourceURL.getPath()); final CharSequence shader = ShaderCode.readShaderSource(null, resourceName, false); diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/ImageSequence.java b/src/jogl/classes/com/jogamp/opengl/util/texture/ImageSequence.java index 0f51c2e14..e485e5452 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/ImageSequence.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/ImageSequence.java @@ -77,7 +77,7 @@ public class ImageSequence implements TextureSequence { } public final void addFrame(final GL gl, final Class<?> context, final String imageResourcePath, final String imageSuffix) throws IOException { - final URLConnection urlConn = IOUtil.getResource(context, imageResourcePath); + final URLConnection urlConn = IOUtil.getResource(imageResourcePath, context.getClassLoader(), context); if(null != urlConn) { final TextureData texData = TextureIO.newTextureData(GLProfile.getGL2ES2(), urlConn.getInputStream(), false, imageSuffix); final Texture tex = new Texture(getTextureTarget()); diff --git a/src/jogl/classes/jogamp/graph/font/UbuntuFontLoader.java b/src/jogl/classes/jogamp/graph/font/UbuntuFontLoader.java index e4b0cb2a8..f52292769 100644 --- a/src/jogl/classes/jogamp/graph/font/UbuntuFontLoader.java +++ b/src/jogl/classes/jogamp/graph/font/UbuntuFontLoader.java @@ -52,7 +52,6 @@ public class UbuntuFontLoader implements FontSet { private static final Uri.Encoded jarSubDir = Uri.Encoded.cast("atomic/"); private static final Uri.Encoded jarName = Uri.Encoded.cast("jogl-fonts-p0.jar"); - private static final String relFontPath = "fonts/ubuntu/" ; private static final String absFontPath = "jogamp/graph/font/fonts/ubuntu/" ; private static final FontSet fontLoader = new UbuntuFontLoader(); @@ -160,15 +159,14 @@ public class UbuntuFontLoader implements FontSet { } } } - final String path = useTempJARCache ? absFontPath : relFontPath; try { - final Font f = abspathImpl(path+fname, family, style); + final Font f = abspathImpl(absFontPath+fname, family, style); if( null != f ) { return f; } - throw new IOException(String.format("Problem loading font %s, stream %s%s", fname, path, fname)); + throw new IOException(String.format("Problem loading font %s, stream %s%s", fname, absFontPath, fname)); } catch(final Exception e) { - throw new IOException(String.format("Problem loading font %s, stream %s%s", fname, path, fname), e); + throw new IOException(String.format("Problem loading font %s, stream %s%s", fname, absFontPath, fname), e); } } private Font abspathImpl(final String fname, final int family, final int style) throws IOException { @@ -190,7 +188,7 @@ public class UbuntuFontLoader implements FontSet { throw new IOException(privErr[0]); } } else { - final URLConnection urlConn = IOUtil.getResource(UbuntuFontLoader.class, fname); + final URLConnection urlConn = IOUtil.getResource(fname, getClass().getClassLoader(), null); stream = null != urlConn ? urlConn.getInputStream() : null; } if(null != stream) { diff --git a/src/newt/classes/com/jogamp/newt/NewtFactory.java b/src/newt/classes/com/jogamp/newt/NewtFactory.java index 2ed2194d8..f7b5a1340 100644 --- a/src/newt/classes/com/jogamp/newt/NewtFactory.java +++ b/src/newt/classes/com/jogamp/newt/NewtFactory.java @@ -59,6 +59,7 @@ public class NewtFactory { public static final String DRIVER_DEFAULT_ROOT_PACKAGE = "jogamp.newt.driver"; private static IOUtil.ClassResources defaultWindowIcons; + private static String sysPaths = "newt/data/jogamp-16x16.png newt/data/jogamp-32x32.png"; static { AccessController.doPrivileged(new PrivilegedAction<Object>() { @@ -67,12 +68,11 @@ public class NewtFactory { NativeWindowFactory.initSingleton(); // last resort .. { /** See API Doc in {@link Window} ! */ - final String[] paths = PropertyAccess.getProperty("newt.window.icons", true, "newt/data/jogamp-16x16.png newt/data/jogamp-32x32.png").split("\\s"); + final String[] paths = PropertyAccess.getProperty("newt.window.icons", true, sysPaths).split("\\s"); if( paths.length < 2 ) { throw new IllegalArgumentException("Property 'newt.window.icons' did not specify at least two PNG icons, but "+Arrays.toString(paths)); } - final Class<?> clazz = NewtFactory.class; - defaultWindowIcons = new IOUtil.ClassResources(clazz, paths); + defaultWindowIcons = new IOUtil.ClassResources(paths, NewtFactory.class.getClassLoader(), null); } return null; } } ); diff --git a/src/newt/classes/com/jogamp/newt/opengl/util/NEWTDemoListener.java b/src/newt/classes/com/jogamp/newt/opengl/util/NEWTDemoListener.java index d49ddab42..84c4683db 100644 --- a/src/newt/classes/com/jogamp/newt/opengl/util/NEWTDemoListener.java +++ b/src/newt/classes/com/jogamp/newt/opengl/util/NEWTDemoListener.java @@ -440,7 +440,7 @@ public class NEWTDemoListener extends WindowAdapter implements KeyListener, Mous disp.createNative(); { PointerIcon _pointerIcon = null; - final IOUtil.ClassResources res = new IOUtil.ClassResources(disp.getClass(), new String[] { "newt/data/cross-grey-alpha-16x16.png" } ); + final IOUtil.ClassResources res = new IOUtil.ClassResources(new String[] { "newt/data/cross-grey-alpha-16x16.png" }, disp.getClass().getClassLoader(), null); try { _pointerIcon = disp.createPointerIcon(res, 8, 8); pointerIcons.add(_pointerIcon); @@ -451,7 +451,7 @@ public class NEWTDemoListener extends WindowAdapter implements KeyListener, Mous } { PointerIcon _pointerIcon = null; - final IOUtil.ClassResources res = new IOUtil.ClassResources(disp.getClass(), new String[] { "newt/data/pointer-grey-alpha-16x24.png" } ); + final IOUtil.ClassResources res = new IOUtil.ClassResources(new String[] { "newt/data/pointer-grey-alpha-16x24.png" }, disp.getClass().getClassLoader(), null); try { _pointerIcon = disp.createPointerIcon(res, 0, 0); pointerIcons.add(_pointerIcon); @@ -462,7 +462,7 @@ public class NEWTDemoListener extends WindowAdapter implements KeyListener, Mous } { PointerIcon _pointerIcon = null; - final IOUtil.ClassResources res = new IOUtil.ClassResources(disp.getClass(), new String[] { "arrow-red-alpha-64x64.png" } ); + final IOUtil.ClassResources res = new IOUtil.ClassResources(new String[] { "arrow-red-alpha-64x64.png" }, disp.getClass().getClassLoader(), null); try { _pointerIcon = disp.createPointerIcon(res, 0, 0); pointerIcons.add(_pointerIcon); @@ -473,7 +473,7 @@ public class NEWTDemoListener extends WindowAdapter implements KeyListener, Mous } { PointerIcon _pointerIcon = null; - final IOUtil.ClassResources res = new IOUtil.ClassResources(disp.getClass(), new String[] { "arrow-blue-alpha-64x64.png" } ); + final IOUtil.ClassResources res = new IOUtil.ClassResources(new String[] { "arrow-blue-alpha-64x64.png" }, disp.getClass().getClassLoader(), null); try { _pointerIcon = disp.createPointerIcon(res, 0, 0); pointerIcons.add(_pointerIcon); @@ -484,7 +484,7 @@ public class NEWTDemoListener extends WindowAdapter implements KeyListener, Mous } if( PNGIcon.isAvailable() ) { PointerIcon _pointerIcon = null; - final IOUtil.ClassResources res = new IOUtil.ClassResources(disp.getClass(), new String[] { "jogamp-pointer-64x64.png" } ); + final IOUtil.ClassResources res = new IOUtil.ClassResources(new String[] { "jogamp-pointer-64x64.png" }, disp.getClass().getClassLoader(), null); try { final URLConnection urlConn = res.resolve(0); if( null != urlConn ) { diff --git a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/DisplayDriver.java index d111e850e..715d32ceb 100644 --- a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/DisplayDriver.java +++ b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/DisplayDriver.java @@ -67,7 +67,7 @@ public class DisplayDriver extends DisplayImpl { PNGPixelRect image = null; if( DisplayImpl.isPNGUtilAvailable() ) { - final IOUtil.ClassResources res = new IOUtil.ClassResources(DisplayDriver.class, new String[] { "newt/data/pointer-grey-alpha-16x24.png" } ); + final IOUtil.ClassResources res = new IOUtil.ClassResources(new String[] { "newt/data/pointer-grey-alpha-16x24.png" }, DisplayDriver.class.getClassLoader(), null); try { final URLConnection urlConn = res.resolve(0); image = PNGPixelRect.read(urlConn.getInputStream(), PixelFormat.BGRA8888, false /* directBuffer */, 0 /* destMinStrideInBytes */, false /* destIsGLOriented */); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/FontSet01.java b/src/test/com/jogamp/opengl/test/junit/graph/FontSet01.java index 0666ec4db..38eda9adf 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/FontSet01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/FontSet01.java @@ -14,22 +14,22 @@ public class FontSet01 { fonts[i++] = FontFactory.get(FontFactory.UBUNTU).getDefault(); // FontSet.FAMILY_REGULAR, FontSet.STYLE_NONE fonts[i++] = FontFactory.get(FontFactory.UBUNTU).get(FontSet.FAMILY_REGULAR, FontSet.STYLE_ITALIC); fonts[i++] = FontFactory.get(FontFactory.UBUNTU).get(FontSet.FAMILY_REGULAR, FontSet.STYLE_BOLD); - fonts[i++] = FontFactory.get(IOUtil.getResource(TestTextRendererNEWTBugXXXX.class, - "fonts/freefont/FreeMono.ttf").getInputStream(), true); - fonts[i++] = FontFactory.get(IOUtil.getResource(TestTextRendererNEWTBugXXXX.class, - "fonts/freefont/FreeMonoBold.ttf").getInputStream(), true); - fonts[i++] = FontFactory.get(IOUtil.getResource(TestTextRendererNEWTBugXXXX.class, - "fonts/freefont/FreeSans.ttf").getInputStream(), true); - fonts[i++] = FontFactory.get(IOUtil.getResource(TestTextRendererNEWTBugXXXX.class, - "fonts/freefont/FreeSansBold.ttf").getInputStream(), true); - fonts[i++] = FontFactory.get(IOUtil.getResource(TestTextRendererNEWTBugXXXX.class, - "fonts/freefont/FreeSerif.ttf").getInputStream(), true); - fonts[i++] = FontFactory.get(IOUtil.getResource(TestTextRendererNEWTBugXXXX.class, - "fonts/freefont/FreeSerifBold.ttf").getInputStream(), true); - fonts[i++] = FontFactory.get(IOUtil.getResource(TestTextRendererNEWTBugXXXX.class, - "fonts/freefont/FreeSerifBoldItalic.ttf").getInputStream(), true); - fonts[i++] = FontFactory.get(IOUtil.getResource(TestTextRendererNEWTBugXXXX.class, - "fonts/freefont/FreeSerifItalic.ttf").getInputStream(), true); + fonts[i++] = FontFactory.get(IOUtil.getResource("fonts/freefont/FreeMono.ttf", + TestTextRendererNEWTBugXXXX.class.getClassLoader(), TestTextRendererNEWTBugXXXX.class).getInputStream(), true); + fonts[i++] = FontFactory.get(IOUtil.getResource("fonts/freefont/FreeMonoBold.ttf", + TestTextRendererNEWTBugXXXX.class.getClassLoader(), TestTextRendererNEWTBugXXXX.class).getInputStream(), true); + fonts[i++] = FontFactory.get(IOUtil.getResource("fonts/freefont/FreeSans.ttf", + TestTextRendererNEWTBugXXXX.class.getClassLoader(), TestTextRendererNEWTBugXXXX.class).getInputStream(), true); + fonts[i++] = FontFactory.get(IOUtil.getResource("fonts/freefont/FreeSansBold.ttf", + TestTextRendererNEWTBugXXXX.class.getClassLoader(), TestTextRendererNEWTBugXXXX.class).getInputStream(), true); + fonts[i++] = FontFactory.get(IOUtil.getResource("fonts/freefont/FreeSerif.ttf", + TestTextRendererNEWTBugXXXX.class.getClassLoader(), TestTextRendererNEWTBugXXXX.class).getInputStream(), true); + fonts[i++] = FontFactory.get(IOUtil.getResource("fonts/freefont/FreeSerifBold.ttf", + TestTextRendererNEWTBugXXXX.class.getClassLoader(), TestTextRendererNEWTBugXXXX.class).getInputStream(), true); + fonts[i++] = FontFactory.get(IOUtil.getResource("fonts/freefont/FreeSerifBoldItalic.ttf", + TestTextRendererNEWTBugXXXX.class.getClassLoader(), TestTextRendererNEWTBugXXXX.class).getInputStream(), true); + fonts[i++] = FontFactory.get(IOUtil.getResource("fonts/freefont/FreeSerifItalic.ttf", + TestTextRendererNEWTBugXXXX.class.getClassLoader(), TestTextRendererNEWTBugXXXX.class).getInputStream(), true); return fonts; } } diff --git a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT10.java b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT10.java index 4e66f6920..37d457057 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT10.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT10.java @@ -102,7 +102,7 @@ public class TestTextRendererNEWT10 extends UITestCase { forceGL3 = true; } else if(args[i].equals("-font")) { i++; - font = FontFactory.get(IOUtil.getResource(TestTextRendererNEWT10.class, args[i]).getInputStream(), true); + font = FontFactory.get(IOUtil.getResource(args[i], TestTextRendererNEWT10.class.getClassLoader(), TestTextRendererNEWT10.class).getInputStream(), true); } else if(args[i].equals("-fontSize")) { i++; fontSize = MiscUtils.atof(args[i], fontSize); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2SimpleNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2SimpleNEWT.java index 849fcb16d..992d3c58e 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2SimpleNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2SimpleNEWT.java @@ -118,7 +118,7 @@ public class TestGearsES2SimpleNEWT extends UITestCase { int idx = 0; { PointerIcon _pointerIcon = null; - final IOUtil.ClassResources res = new IOUtil.ClassResources(glWindow.getClass(), new String[] { "newt/data/cross-grey-alpha-16x16.png" } ); + final IOUtil.ClassResources res = new IOUtil.ClassResources(new String[] { "newt/data/cross-grey-alpha-16x16.png" }, glWindow.getClass().getClassLoader(), null); try { _pointerIcon = disp.createPointerIcon(res, 8, 8); System.err.printf("Create PointerIcon #%02d: %s%n", idx, _pointerIcon.toString()); @@ -130,7 +130,7 @@ public class TestGearsES2SimpleNEWT extends UITestCase { idx++; { PointerIcon _pointerIcon = null; - final IOUtil.ClassResources res = new IOUtil.ClassResources(glWindow.getClass(), new String[] { "newt/data/pointer-grey-alpha-16x24.png" } ); + final IOUtil.ClassResources res = new IOUtil.ClassResources(new String[] { "newt/data/pointer-grey-alpha-16x24.png" }, glWindow.getClass().getClassLoader(), null); try { _pointerIcon = disp.createPointerIcon(res, 0, 0); System.err.printf("Create PointerIcon #%02d: %s%n", idx, _pointerIcon.toString()); @@ -142,7 +142,7 @@ public class TestGearsES2SimpleNEWT extends UITestCase { idx++; { PointerIcon _pointerIcon = null; - final IOUtil.ClassResources res = new IOUtil.ClassResources(glWindow.getClass(), new String[] { "arrow-red-alpha-64x64.png" } ); + final IOUtil.ClassResources res = new IOUtil.ClassResources(new String[] { "arrow-red-alpha-64x64.png" }, glWindow.getClass().getClassLoader(), null); try { _pointerIcon = disp.createPointerIcon(res, 0, 0); System.err.printf("Create PointerIcon #%02d: %s%n", idx, _pointerIcon.toString()); @@ -154,7 +154,7 @@ public class TestGearsES2SimpleNEWT extends UITestCase { idx++; { PointerIcon _pointerIcon = null; - final IOUtil.ClassResources res = new IOUtil.ClassResources(glWindow.getClass(), new String[] { "arrow-blue-alpha-64x64.png" } ); + final IOUtil.ClassResources res = new IOUtil.ClassResources(new String[] { "arrow-blue-alpha-64x64.png" }, glWindow.getClass().getClassLoader(), null); try { _pointerIcon = disp.createPointerIcon(res, 0, 0); System.err.printf("Create PointerIcon #%02d: %s%n", idx, _pointerIcon.toString()); @@ -166,7 +166,7 @@ public class TestGearsES2SimpleNEWT extends UITestCase { idx++; if( PNGIcon.isAvailable() ) { PointerIcon _pointerIcon = null; - final IOUtil.ClassResources res = new IOUtil.ClassResources(glWindow.getClass(), new String[] { "jogamp-pointer-64x64.png" } ); + final IOUtil.ClassResources res = new IOUtil.ClassResources(new String[] { "jogamp-pointer-64x64.png" }, glWindow.getClass().getClassLoader(), null); try { final URLConnection urlConn = res.resolve(0); final PNGPixelRect image = PNGPixelRect.read(urlConn.getInputStream(), null, false /* directBuffer */, 0 /* destMinStrideInBytes */, false /* destIsGLOriented */); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/Teapot.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/Teapot.java index 22d24b67b..159fad9da 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/Teapot.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/Teapot.java @@ -72,7 +72,7 @@ public class Teapot implements GLEventListener { gl.glClearColor(0.5f, 0.5f, 0.5f, 0.0f); try { - final URLConnection urlConn = IOUtil.getResource(PNGTstFiles.class, "test-ntscP_3-01-160x90.png"); + final URLConnection urlConn = IOUtil.getResource("test-ntscP_3-01-160x90.png", PNGTstFiles.class.getClassLoader(), PNGTstFiles.class); tex = TextureIO.newTexture(gl, TextureIO.newTextureData(gl.getGLProfile(), urlConn.getInputStream(), false, TextureIO.PNG)); } catch (final Exception e) { e.printStackTrace(); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl3/GeomShader01TextureGL3.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl3/GeomShader01TextureGL3.java index a4a665e5b..668d8877c 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl3/GeomShader01TextureGL3.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl3/GeomShader01TextureGL3.java @@ -193,7 +193,7 @@ public class GeomShader01TextureGL3 implements GLEventListener { } private Texture createTestTexture(final GL3 gl) throws IOException { - final URLConnection urlConn = IOUtil.getResource(this.getClass(), "../../util/texture/test-ntscN_3-01-160x90.png"); + final URLConnection urlConn = IOUtil.getResource("../../util/texture/test-ntscN_3-01-160x90.png", this.getClass().getClassLoader(), this.getClass()); if(null == urlConn) { return null; } final InputStream istream = urlConn.getInputStream(); if(null == istream) { return null; } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/DemoGL2ES1TextureImmModeSink.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/DemoGL2ES1TextureImmModeSink.java index f90b32009..572871233 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/DemoGL2ES1TextureImmModeSink.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/DemoGL2ES1TextureImmModeSink.java @@ -97,7 +97,7 @@ public class DemoGL2ES1TextureImmModeSink implements GLEventListener, TextureDra } final GL2ES1 gl = FixedFuncUtil.wrapFixedFuncEmul(_gl, ShaderSelectionMode.AUTO, null, forceFFPEmu, verboseFFPEmu); - final URLConnection testTextureUrlConn = IOUtil.getResource(PNGTstFiles.class, "test-ntscP_3-01-160x90.png"); + final URLConnection testTextureUrlConn = IOUtil.getResource("test-ntscP_3-01-160x90.png", PNGTstFiles.class.getClassLoader(), PNGTstFiles.class); try { final InputStream testTextureStream = testTextureUrlConn.getInputStream(); textureData = TextureIO.newTextureData(gl.getGLProfile(), testTextureStream , false /* mipmap */, TextureIO.PNG); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/ImageTstFiles.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/ImageTstFiles.java index dfd3f6366..25bb7e788 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/ImageTstFiles.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/ImageTstFiles.java @@ -96,7 +96,7 @@ public class ImageTstFiles { private final ArrayList<NamedInputStream> init(final String[] source) throws IOException { final ArrayList<NamedInputStream> sink = new ArrayList<NamedInputStream>(); for(int i=0; i<source.length; i++) { - final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), source[i]); + final URLConnection testTextureUrlConn = IOUtil.getResource(source[i], this.getClass().getClassLoader(), this.getClass()); if( null != testTextureUrlConn ) { final InputStream s = testTextureUrlConn.getInputStream(); if( null != s ) { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestBug362DDSImageCreateFromData.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestBug362DDSImageCreateFromData.java index a585e9eaf..71233d07c 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestBug362DDSImageCreateFromData.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestBug362DDSImageCreateFromData.java @@ -56,7 +56,7 @@ public class TestBug362DDSImageCreateFromData { } private File initFile(final String filename) throws URISyntaxException { - final URLConnection connection = IOUtil.getResource(getClass(), filename); + final URLConnection connection = IOUtil.getResource(filename, getClass().getClassLoader(), getClass()); Assert.assertNotNull(connection); final URL url = connection.getURL(); final File file = new File(url.toURI()); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGImage01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGImage01NEWT.java index 925382901..8ccc73f34 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGImage01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGImage01NEWT.java @@ -146,7 +146,7 @@ public class TestJPEGImage01NEWT extends UITestCase { @Test public void testReadES2_RGBn() throws InterruptedException, IOException, MalformedURLException { final String fname = null == _fname ? "test-ntscN_3-01-160x90-90pct-yuv444-base.jpg" : _fname; - final URLConnection urlConn = IOUtil.getResource(this.getClass(), fname); + final URLConnection urlConn = IOUtil.getResource(fname, this.getClass().getClassLoader(), this.getClass()); testImpl(urlConn.getInputStream()); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGJoglAWTBenchmarkNewtAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGJoglAWTBenchmarkNewtAWT.java index 4fc774463..87a993de4 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGJoglAWTBenchmarkNewtAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGJoglAWTBenchmarkNewtAWT.java @@ -64,7 +64,7 @@ public class TestJPEGJoglAWTBenchmarkNewtAWT extends UITestCase { { final long t0 = System.currentTimeMillis(); for(int i = 0; i< loops; i++ ) { - final URLConnection urlConn = IOUtil.getResource(this.getClass(), fname); + final URLConnection urlConn = IOUtil.getResource(fname, this.getClass().getClassLoader(), this.getClass()); final InputStream istream = urlConn.getInputStream(); final JPEGImage image = JPEGImage.read(istream); // parsing & completion done !!! final int internalFormat = (image.getBytesPerPixel()==4)?GL.GL_RGBA:GL.GL_RGB; @@ -92,7 +92,7 @@ public class TestJPEGJoglAWTBenchmarkNewtAWT extends UITestCase { { final long t0 = System.currentTimeMillis(); for(int i = 0; i< loops; i++ ) { - final URLConnection urlConn = IOUtil.getResource(this.getClass(), fname); + final URLConnection urlConn = IOUtil.getResource(fname, this.getClass().getClassLoader(), this.getClass()); final InputStream istream = urlConn.getInputStream(); final JPEGImage image = JPEGImage.read(istream, TextureData.ColorSpace.YCbCr); // parsing & completion done !!! final int internalFormat = (image.getBytesPerPixel()==4)?GL.GL_RGBA:GL.GL_RGB; @@ -120,7 +120,7 @@ public class TestJPEGJoglAWTBenchmarkNewtAWT extends UITestCase { { final long t0 = System.currentTimeMillis(); for(int i = 0; i< loops; i++ ) { - final URLConnection urlConn = IOUtil.getResource(this.getClass(), fname); + final URLConnection urlConn = IOUtil.getResource(fname, this.getClass().getClassLoader(), this.getClass()); final InputStream istream = urlConn.getInputStream(); Buffer data = null; try { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGJoglAWTCompareNewtAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGJoglAWTCompareNewtAWT.java index d5c80553d..b48000046 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGJoglAWTCompareNewtAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGJoglAWTCompareNewtAWT.java @@ -101,7 +101,7 @@ public class TestJPEGJoglAWTCompareNewtAWT extends UITestCase { } GLWindow testJOGLJpeg(final String fname) throws InterruptedException, IOException { - final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), fname); + final URLConnection testTextureUrlConn = IOUtil.getResource(fname, this.getClass().getClassLoader(), this.getClass()); Assert.assertNotNull(testTextureUrlConn); final InputStream istream = testTextureUrlConn.getInputStream(); Assert.assertNotNull(istream); @@ -160,7 +160,7 @@ public class TestJPEGJoglAWTCompareNewtAWT extends UITestCase { } GLWindow testAWTJpeg(final String fname, final int xpos) throws InterruptedException, IOException { - final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), fname); + final URLConnection testTextureUrlConn = IOUtil.getResource(fname, this.getClass().getClassLoader(), this.getClass()); Assert.assertNotNull(testTextureUrlConn); final InputStream istream = testTextureUrlConn.getInputStream(); Assert.assertNotNull(istream); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGTextureFromFileNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGTextureFromFileNEWT.java index 114561666..b43fba479 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGTextureFromFileNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGTextureFromFileNEWT.java @@ -82,63 +82,63 @@ public class TestJPEGTextureFromFileNEWT extends UITestCase { @Before public void initTest() throws IOException { { - final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-ntscN_3-01-160x90-90pct-yuv444-base.jpg"); + final URLConnection testTextureUrlConn = IOUtil.getResource("test-ntscN_3-01-160x90-90pct-yuv444-base.jpg", this.getClass().getClassLoader(), this.getClass()); Assert.assertNotNull(testTextureUrlConn); testTextureStream01YUV444_Base = testTextureUrlConn.getInputStream(); Assert.assertNotNull(testTextureStream01YUV444_Base); } { - final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-ntscN_3-01-160x90-90pct-yuv444-prog.jpg"); + final URLConnection testTextureUrlConn = IOUtil.getResource("test-ntscN_3-01-160x90-90pct-yuv444-prog.jpg", this.getClass().getClassLoader(), this.getClass()); Assert.assertNotNull(testTextureUrlConn); testTextureStream01YUV444_Prog = testTextureUrlConn.getInputStream(); Assert.assertNotNull(testTextureStream01YUV444_Prog); } { - final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-ntscN_3-01-160x90-60pct-yuv422h-base.jpg"); + final URLConnection testTextureUrlConn = IOUtil.getResource("test-ntscN_3-01-160x90-60pct-yuv422h-base.jpg", this.getClass().getClassLoader(), this.getClass()); Assert.assertNotNull(testTextureUrlConn); testTextureStream01YUV422h_Base = testTextureUrlConn.getInputStream(); Assert.assertNotNull(testTextureStream01YUV422h_Base); } { - final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-ntscN_3-01-160x90-60pct-yuv422h-prog.jpg"); + final URLConnection testTextureUrlConn = IOUtil.getResource("test-ntscN_3-01-160x90-60pct-yuv422h-prog.jpg", this.getClass().getClassLoader(), this.getClass()); Assert.assertNotNull(testTextureUrlConn); testTextureStream01YUV422h_Prog = testTextureUrlConn.getInputStream(); Assert.assertNotNull(testTextureStream01YUV422h_Prog); } { - final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "j1-baseline.jpg"); + final URLConnection testTextureUrlConn = IOUtil.getResource("j1-baseline.jpg", this.getClass().getClassLoader(), this.getClass()); Assert.assertNotNull(testTextureUrlConn); testTextureStream02YUV420_Base = testTextureUrlConn.getInputStream(); Assert.assertNotNull(testTextureStream02YUV420_Base); } { - final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "j2-progressive.jpg"); + final URLConnection testTextureUrlConn = IOUtil.getResource("j2-progressive.jpg", this.getClass().getClassLoader(), this.getClass()); Assert.assertNotNull(testTextureUrlConn); testTextureStream02YUV420_Prog = testTextureUrlConn.getInputStream(); Assert.assertNotNull(testTextureStream02YUV420_Prog); } { - final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "j3-baseline_gray.jpg"); + final URLConnection testTextureUrlConn = IOUtil.getResource("j3-baseline_gray.jpg", this.getClass().getClassLoader(), this.getClass()); Assert.assertNotNull(testTextureUrlConn); testTextureStream02YUV420_BaseGray = testTextureUrlConn.getInputStream(); Assert.assertNotNull(testTextureStream02YUV420_BaseGray); } { - final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-cmyk-01.jpg"); + final URLConnection testTextureUrlConn = IOUtil.getResource("test-cmyk-01.jpg", this.getClass().getClassLoader(), this.getClass()); Assert.assertNotNull(testTextureUrlConn); testTextureStream03CMYK_01 = testTextureUrlConn.getInputStream(); Assert.assertNotNull(testTextureStream03CMYK_01); } { - final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-ycck-01.jpg"); + final URLConnection testTextureUrlConn = IOUtil.getResource("test-ycck-01.jpg", this.getClass().getClassLoader(), this.getClass()); Assert.assertNotNull(testTextureUrlConn); testTextureStream03YCCK_01 = testTextureUrlConn.getInputStream(); Assert.assertNotNull(testTextureStream03YCCK_01); } { - final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "bug745_qttdef_post_frame.jpg"); + final URLConnection testTextureUrlConn = IOUtil.getResource("bug745_qttdef_post_frame.jpg", this.getClass().getClassLoader(), this.getClass()); Assert.assertNotNull(testTextureUrlConn); testTextureStream04QTTDefPostFrame = testTextureUrlConn.getInputStream(); Assert.assertNotNull(testTextureStream04QTTDefPostFrame); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGPixelRect00NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGPixelRect00NEWT.java index 3918b6cb7..0506f840e 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGPixelRect00NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGPixelRect00NEWT.java @@ -128,7 +128,7 @@ public class TestPNGPixelRect00NEWT extends UITestCase { final File out2F_f=new File(getSimpleTestName(".")+"-02-"+basename+"-flipped.png"); final File out2R_f=new File(getSimpleTestName(".")+"-03-"+basename+"-reversed.png"); final File out2RF_f=new File(getSimpleTestName(".")+"-04-"+basename+"-reversed_flipped.png"); - final URLConnection urlConn = IOUtil.getResource(this.getClass(), pathname+basename+".png"); + final URLConnection urlConn = IOUtil.getResource(pathname+basename+".png", this.getClass().getClassLoader(), this.getClass()); if( null == urlConn ) { throw new IOException("Cannot find "+pathname+basename+".png"); } @@ -205,7 +205,7 @@ public class TestPNGPixelRect00NEWT extends UITestCase { System.err.println("Test02: "+pathname+basename+".png, destFmt "+destFmt+", destMinStrideInBytes "+destMinStrideInBytes+", destIsGLOriented "+destIsGLOriented); final File out1_f=new File(getSimpleTestName(".")+"-"+basename+"-orig.png"); - final URLConnection urlConn = IOUtil.getResource(this.getClass(), pathname+basename+".png"); + final URLConnection urlConn = IOUtil.getResource(pathname+basename+".png", this.getClass().getClassLoader(), this.getClass()); final PNGPixelRect image1 = PNGPixelRect.read(urlConn.getInputStream(), destFmt, false /* directBuffer */, destMinStrideInBytes, destIsGLOriented); System.err.println("PNGPixelRect - Orig: "+image1); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGPixelRect01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGPixelRect01NEWT.java index e299932b3..b6a047d03 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGPixelRect01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGPixelRect01NEWT.java @@ -156,7 +156,7 @@ public class TestPNGPixelRect01NEWT extends UITestCase { if( null == _fname ) { return; } - final URLConnection urlConn = IOUtil.getResource(this.getClass(), _fname); + final URLConnection urlConn = IOUtil.getResource(_fname, this.getClass().getClassLoader(), this.getClass()); if( null == urlConn ) { throw new IOException("Cannot find "+_fname+".png"); } @@ -170,7 +170,7 @@ public class TestPNGPixelRect01NEWT extends UITestCase { } for(int i=0; i<PNGTstFiles.allBasenames.length; i++) { final String basename = PNGTstFiles.allBasenames[i]; - final URLConnection urlConn = IOUtil.getResource(this.getClass(), basename+".png"); + final URLConnection urlConn = IOUtil.getResource(basename+".png", this.getClass().getClassLoader(), this.getClass()); if( null == urlConn ) { throw new IOException("Cannot find "+basename+".png"); } @@ -184,7 +184,7 @@ public class TestPNGPixelRect01NEWT extends UITestCase { } for(int i=0; i<PNGTstFiles.greyBasenames.length; i++) { final String basename = PNGTstFiles.greyBasenames[i]; - final URLConnection urlConn = IOUtil.getResource(this.getClass(), basename+".png"); + final URLConnection urlConn = IOUtil.getResource(basename+".png", this.getClass().getClassLoader(), this.getClass()); if( null == urlConn ) { throw new IOException("Cannot find "+basename+".png"); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGTextureFromFileAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGTextureFromFileAWT.java index 2d6b6da71..157fffb90 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGTextureFromFileAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGTextureFromFileAWT.java @@ -86,7 +86,7 @@ public class TestPNGTextureFromFileAWT extends UITestCase { grayTextureStream = TestPNGTextureFromFileAWT.class.getResourceAsStream( "grayscale_texture.png" ); Assert.assertNotNull(grayTextureStream); { - final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-ntscN_3-01-160x90.png"); + final URLConnection testTextureUrlConn = IOUtil.getResource("test-ntscN_3-01-160x90.png", this.getClass().getClassLoader(), this.getClass()); Assert.assertNotNull(testTextureUrlConn); testTextureStream = testTextureUrlConn.getInputStream(); Assert.assertNotNull(testTextureStream); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGTextureFromFileNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGTextureFromFileNEWT.java index a82767f9a..d7017465e 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGTextureFromFileNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGTextureFromFileNEWT.java @@ -82,44 +82,44 @@ public class TestPNGTextureFromFileNEWT extends UITestCase { grayTextureStream = TestPNGTextureFromFileNEWT.class.getResourceAsStream( "grayscale_texture.png" ); Assert.assertNotNull(grayTextureStream); { - final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-ntscN_3-01-160x90.png"); + final URLConnection testTextureUrlConn = IOUtil.getResource("test-ntscN_3-01-160x90.png", this.getClass().getClassLoader(), this.getClass()); Assert.assertNotNull(testTextureUrlConn); testTextureStreamN_3 = testTextureUrlConn.getInputStream(); Assert.assertNotNull(testTextureStreamN_3); } { - final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-ntscN_4-01-160x90.png"); + final URLConnection testTextureUrlConn = IOUtil.getResource("test-ntscN_4-01-160x90.png", this.getClass().getClassLoader(), this.getClass()); Assert.assertNotNull(testTextureUrlConn); testTextureStreamN_4 = testTextureUrlConn.getInputStream(); Assert.assertNotNull(testTextureStreamN_4); } { - final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-ntscNG4-01-160x90.png"); + final URLConnection testTextureUrlConn = IOUtil.getResource("test-ntscNG4-01-160x90.png", this.getClass().getClassLoader(), this.getClass()); Assert.assertNotNull(testTextureUrlConn); testTextureStreamNG4 = testTextureUrlConn.getInputStream(); Assert.assertNotNull(testTextureStreamNG4); } { - final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-ntscI_3-01-160x90.png"); + final URLConnection testTextureUrlConn = IOUtil.getResource("test-ntscI_3-01-160x90.png", this.getClass().getClassLoader(), this.getClass()); Assert.assertNotNull(testTextureUrlConn); testTextureStreamI_3 = testTextureUrlConn.getInputStream(); Assert.assertNotNull(testTextureStreamI_3); } { - final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-ntscIG3-01-160x90.png"); + final URLConnection testTextureUrlConn = IOUtil.getResource("test-ntscIG3-01-160x90.png", this.getClass().getClassLoader(), this.getClass()); Assert.assertNotNull(testTextureUrlConn); testTextureStreamIG3 = testTextureUrlConn.getInputStream(); Assert.assertNotNull(testTextureStreamIG3); } { - final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-ntscI_4-01-160x90.png"); + final URLConnection testTextureUrlConn = IOUtil.getResource("test-ntscI_4-01-160x90.png", this.getClass().getClassLoader(), this.getClass()); Assert.assertNotNull(testTextureUrlConn); testTextureStreamI_4 = testTextureUrlConn.getInputStream(); Assert.assertNotNull(testTextureStreamI_4); } { - final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-ntscIG4-01-160x90.png"); + final URLConnection testTextureUrlConn = IOUtil.getResource("test-ntscIG4-01-160x90.png", this.getClass().getClassLoader(), this.getClass()); Assert.assertNotNull(testTextureUrlConn); testTextureStreamIG4 = testTextureUrlConn.getInputStream(); Assert.assertNotNull(testTextureStreamIG4); @@ -127,13 +127,13 @@ public class TestPNGTextureFromFileNEWT extends UITestCase { { - final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-ntscP_3-01-160x90.png"); + final URLConnection testTextureUrlConn = IOUtil.getResource("test-ntscP_3-01-160x90.png", this.getClass().getClassLoader(), this.getClass()); Assert.assertNotNull(testTextureUrlConn); testTextureStreamP_3 = testTextureUrlConn.getInputStream(); Assert.assertNotNull(testTextureStreamP_3); } { - final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-ntscP_4-01-160x90.png"); + final URLConnection testTextureUrlConn = IOUtil.getResource("test-ntscP_4-01-160x90.png", this.getClass().getClassLoader(), this.getClass()); Assert.assertNotNull(testTextureUrlConn); testTextureStreamP_4 = testTextureUrlConn.getInputStream(); Assert.assertNotNull(testTextureStreamP_4); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPixelFormatUtil01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPixelFormatUtil01NEWT.java index 618797e66..653ccadfd 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPixelFormatUtil01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPixelFormatUtil01NEWT.java @@ -83,7 +83,7 @@ public class TestPixelFormatUtil01NEWT extends UITestCase { { System.err.println("Test01: "+pathname+basename+".png, srcFmt "+srcFmt+", destMinStrideInBytes "+destMinStrideInBytes+", destIsGLOriented "+destIsGLOriented); - final URLConnection urlConn = IOUtil.getResource(this.getClass(), pathname+basename+".png"); + final URLConnection urlConn = IOUtil.getResource(pathname+basename+".png", this.getClass().getClassLoader(), this.getClass()); final PNGPixelRect image1 = PNGPixelRect.read(urlConn.getInputStream(), srcFmt, false /* directBuffer */, destMinStrideInBytes, false /* isGLOriented */); System.err.println("PNGPixelRect - Orig: "+image1); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTGATextureFromFileNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTGATextureFromFileNEWT.java index 6e0af17da..23f4593d8 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTGATextureFromFileNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTGATextureFromFileNEWT.java @@ -69,19 +69,19 @@ public class TestTGATextureFromFileNEWT extends UITestCase { @Before public void initTest() throws IOException { { - final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-u32.tga"); + final URLConnection testTextureUrlConn = IOUtil.getResource("test-u32.tga", this.getClass().getClassLoader(), this.getClass()); Assert.assertNotNull(testTextureUrlConn); testTextureStream01U32 = testTextureUrlConn.getInputStream(); Assert.assertNotNull(testTextureStream01U32); } { - final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "bug744-rle32.tga"); + final URLConnection testTextureUrlConn = IOUtil.getResource("bug744-rle32.tga", this.getClass().getClassLoader(), this.getClass()); Assert.assertNotNull(testTextureUrlConn); testTextureStream02RLE32 = testTextureUrlConn.getInputStream(); Assert.assertNotNull(testTextureStream02RLE32); } { - final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "bug982.rle32.256x256.tga"); + final URLConnection testTextureUrlConn = IOUtil.getResource("bug982.rle32.256x256.tga", this.getClass().getClassLoader(), this.getClass()); Assert.assertNotNull(testTextureUrlConn); testTextureStream03RLE32 = testTextureUrlConn.getInputStream(); Assert.assertNotNull(testTextureStream03RLE32); diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestWindowAndPointerIconNEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestWindowAndPointerIconNEWT.java index 0ef554ec2..d613f7d94 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestWindowAndPointerIconNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestWindowAndPointerIconNEWT.java @@ -94,7 +94,7 @@ public class TestWindowAndPointerIconNEWT extends SingletonJunitCase { final int idx = 0; { PointerIcon _pointerIcon = null; - final IOUtil.ClassResources res = new IOUtil.ClassResources(glWindow.getClass(), new String[] { "arrow-red-alpha-64x64.png" } ); + final IOUtil.ClassResources res = new IOUtil.ClassResources(new String[] { "arrow-red-alpha-64x64.png" }, glWindow.getClass().getClassLoader(), null); try { _pointerIcon = disp.createPointerIcon(res, 0, 0); System.err.printf("Create PointerIcon #%02d: %s%n", idx, _pointerIcon.toString()); |