aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-06-23 16:21:02 +0200
committerSven Gothel <[email protected]>2013-06-23 16:21:02 +0200
commit698834f062759c7fae342a84af2953e9550c0078 (patch)
tree6af671a023449e6e7783d178815e6a26cb2b8fc0 /src/jogl/classes
parent305cdc83f78a5ac63d5ca1e56538a1eade62bb23 (diff)
GLEmitter: Better use of priviledged block in generated GL*ProcAddressTable's isFunctionAvailableImpl(..), getAddressFor(..)
Diffstat (limited to 'src/jogl/classes')
-rw-r--r--src/jogl/classes/com/jogamp/gluegen/opengl/GLEmitter.java44
1 files changed, 20 insertions, 24 deletions
diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/GLEmitter.java b/src/jogl/classes/com/jogamp/gluegen/opengl/GLEmitter.java
index 7c49b62d7..075c8bfd8 100644
--- a/src/jogl/classes/com/jogamp/gluegen/opengl/GLEmitter.java
+++ b/src/jogl/classes/com/jogamp/gluegen/opengl/GLEmitter.java
@@ -465,22 +465,20 @@ public class GLEmitter extends ProcAddressEmitter {
w.println(" protected boolean isFunctionAvailableImpl(String functionNameUsr) throws IllegalArgumentException {");
w.println(" final String functionNameBase = "+GLNameResolver.class.getName()+".normalizeVEN(com.jogamp.gluegen.runtime.opengl.GLNameResolver.normalizeARB(functionNameUsr, true), true);");
w.println(" final String addressFieldNameBase = \"" + PROCADDRESS_VAR_PREFIX + "\" + functionNameBase;");
- w.println(" java.lang.reflect.Field addressField = null;");
- w.println(" int funcNamePermNum = "+GLNameResolver.class.getName()+".getFuncNamePermutationNumber(functionNameBase);");
- w.println(" for(int i = 0; null==addressField && i < funcNamePermNum; i++) {");
- w.println(" final String addressFieldName = "+GLNameResolver.class.getName()+".getFuncNamePermutation(addressFieldNameBase, i);");
- w.println(" addressField = java.security.AccessController.doPrivileged(new java.security.PrivilegedAction<java.lang.reflect.Field>() {");
- w.println(" public java.lang.reflect.Field run() {");
+ w.println(" final int funcNamePermNum = "+GLNameResolver.class.getName()+".getFuncNamePermutationNumber(functionNameBase);");
+ w.println(" final java.lang.reflect.Field addressField = java.security.AccessController.doPrivileged(new java.security.PrivilegedAction<java.lang.reflect.Field>() {");
+ w.println(" public final java.lang.reflect.Field run() {");
+ w.println(" java.lang.reflect.Field addressField = null;");
+ w.println(" for(int i = 0; i < funcNamePermNum; i++) {");
+ w.println(" final String addressFieldName = "+GLNameResolver.class.getName()+".getFuncNamePermutation(addressFieldNameBase, i);");
w.println(" try {");
- w.println(" final java.lang.reflect.Field addressField = "+tableClassName+".class.getDeclaredField( addressFieldName );");
+ w.println(" addressField = "+tableClassName+".class.getDeclaredField( addressFieldName );");
w.println(" addressField.setAccessible(true); // we need to read the protected value!");
w.println(" return addressField;");
- w.println(" } catch (NoSuchFieldException ex) {");
- w.println(" return null;");
- w.println(" }");
+ w.println(" } catch (NoSuchFieldException ex) { }");
w.println(" }");
- w.println(" } );");
- w.println(" }");
+ w.println(" return null;");
+ w.println(" } } );");
w.println();
w.println(" if(null==addressField) {");
w.println(" // The user is calling a bogus function or one which is not");
@@ -505,22 +503,20 @@ public class GLEmitter extends ProcAddressEmitter {
w.println(" SecurityUtil.checkAllLinkPermission();");
w.println(" final String functionNameBase = "+GLNameResolver.class.getName()+".normalizeVEN(com.jogamp.gluegen.runtime.opengl.GLNameResolver.normalizeARB(functionNameUsr, true), true);");
w.println(" final String addressFieldNameBase = \"" + PROCADDRESS_VAR_PREFIX + "\" + functionNameBase;");
- w.println(" java.lang.reflect.Field addressField = null;");
- w.println(" int funcNamePermNum = "+GLNameResolver.class.getName()+".getFuncNamePermutationNumber(functionNameBase);");
- w.println(" for(int i = 0; null==addressField && i < funcNamePermNum; i++) {");
- w.println(" final String addressFieldName = "+GLNameResolver.class.getName()+".getFuncNamePermutation(addressFieldNameBase, i);");
- w.println(" addressField = java.security.AccessController.doPrivileged(new java.security.PrivilegedAction<java.lang.reflect.Field>() {");
- w.println(" public java.lang.reflect.Field run() {");
+ w.println(" final int funcNamePermNum = "+GLNameResolver.class.getName()+".getFuncNamePermutationNumber(functionNameBase);");
+ w.println(" final java.lang.reflect.Field addressField = java.security.AccessController.doPrivileged(new java.security.PrivilegedAction<java.lang.reflect.Field>() {");
+ w.println(" public final java.lang.reflect.Field run() {");
+ w.println(" java.lang.reflect.Field addressField = null;");
+ w.println(" for(int i = 0; i < funcNamePermNum; i++) {");
+ w.println(" final String addressFieldName = "+GLNameResolver.class.getName()+".getFuncNamePermutation(addressFieldNameBase, i);");
w.println(" try {");
- w.println(" final java.lang.reflect.Field addressField = "+tableClassName+".class.getDeclaredField( addressFieldName );");
+ w.println(" addressField = "+tableClassName+".class.getDeclaredField( addressFieldName );");
w.println(" addressField.setAccessible(true); // we need to read the protected value!");
w.println(" return addressField;");
- w.println(" } catch (NoSuchFieldException ex) {");
- w.println(" return null;");
- w.println(" }");
+ w.println(" } catch (NoSuchFieldException ex) { }");
w.println(" }");
- w.println(" } );");
- w.println(" }");
+ w.println(" return null;");
+ w.println(" } } );");
w.println();
w.println(" if(null==addressField) {");
w.println(" // The user is calling a bogus function or one which is not");