summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/classes/share/javax/media/j3d/JoglPipeline.java37
1 files changed, 19 insertions, 18 deletions
diff --git a/src/classes/share/javax/media/j3d/JoglPipeline.java b/src/classes/share/javax/media/j3d/JoglPipeline.java
index 3f7384d..ca7f5dc 100644
--- a/src/classes/share/javax/media/j3d/JoglPipeline.java
+++ b/src/classes/share/javax/media/j3d/JoglPipeline.java
@@ -6365,25 +6365,26 @@ class JoglPipeline extends Pipeline {
// Fix for Bug 983
private void checkAppContext() {
- if (mainThreadContext != null) {
- try {
- // Check by reflection that sun.awt.AppContext.getAppContext() doesn't return null
- // (required by ImageIO.write() and other JMF internal calls) to apply workaround proposed at
- // http://stackoverflow.com/questions/17223304/appcontext-is-null-from-rmi-thread-with-java-7-update-25
- final Class<?> appContextClass = Class.forName("sun.awt.AppContext");
- if (appContextClass.getMethod("getAppContext").invoke(null) == null) {
- final Field field = appContextClass.getDeclaredField("threadGroup2appContext");
- field.setAccessible(true);
- final Map threadGroup2appContext = (Map)field.get(null);
- final ThreadGroup currentThreadGroup = Thread.currentThread().getThreadGroup();
- threadGroup2appContext.put(currentThreadGroup, mainThreadContext);
- }
- } catch (final Throwable ex) {
- // Let's consider app context is not necessary for the program
- }
- // Don't need mainThreadContext anymore
- mainThreadContext = null;
+ if (mainThreadContext == null)
+ return;
+
+ try {
+ // Check by reflection that sun.awt.AppContext.getAppContext() doesn't return null
+ // (required by ImageIO.write() and other JMF internal calls) to apply workaround proposed at
+ // http://stackoverflow.com/questions/17223304/appcontext-is-null-from-rmi-thread-with-java-7-update-25
+ final Class<?> appContextClass = Class.forName("sun.awt.AppContext");
+ if (appContextClass.getMethod("getAppContext").invoke(null) == null) {
+ final Field field = appContextClass.getDeclaredField("threadGroup2appContext");
+ field.setAccessible(true);
+ final Map threadGroup2appContext = (Map)field.get(null);
+ final ThreadGroup currentThreadGroup = Thread.currentThread().getThreadGroup();
+ threadGroup2appContext.put(currentThreadGroup, mainThreadContext);
+ }
+ } catch (Throwable ex) {
+ // Let's consider app context is not necessary for the program
}
+ // Don't need mainThreadContext anymore
+ mainThreadContext = null;
}
// This is the native method for creating the underlying graphics context.