diff options
Diffstat (limited to 'src/java/com/jogamp')
3 files changed, 20 insertions, 13 deletions
diff --git a/src/java/com/jogamp/common/os/DynamicLibraryBundle.java b/src/java/com/jogamp/common/os/DynamicLibraryBundle.java index 06cef6f..c578565 100644 --- a/src/java/com/jogamp/common/os/DynamicLibraryBundle.java +++ b/src/java/com/jogamp/common/os/DynamicLibraryBundle.java @@ -231,7 +231,7 @@ public class DynamicLibraryBundle implements DynamicLookupHelper { public final DynamicLibraryBundleInfo getBundleInfo() { return info; } - protected final long getToolGetProcAddressHandle() { + protected final long getToolGetProcAddressHandle() throws SecurityException { if(!isToolLibLoaded()) { return 0; } @@ -246,7 +246,7 @@ public class DynamicLibraryBundle implements DynamicLookupHelper { return aptr; } - protected static final NativeLibrary loadFirstAvailable(final List<String> libNames, final ClassLoader loader, final boolean global) { + protected static final NativeLibrary loadFirstAvailable(final List<String> libNames, final ClassLoader loader, final boolean global) throws SecurityException { for (int i=0; i < libNames.size(); i++) { final NativeLibrary lib = NativeLibrary.open(libNames.get(i), loader, global); if (lib != null) { @@ -256,7 +256,7 @@ public class DynamicLibraryBundle implements DynamicLookupHelper { return null; } - final DynamicLinker loadLibraries() { + final DynamicLinker loadLibraries() throws SecurityException { int i; toolLibLoadedNumber = 0; final ClassLoader cl = info.getClass().getClassLoader(); @@ -317,7 +317,12 @@ public class DynamicLibraryBundle implements DynamicLookupHelper { return dynLinkGlobal; } - private final long dynamicLookupFunctionOnLibs(final String funcName) { + /** + * @param funcName + * @return + * @throws SecurityException if user is not granted access for the library set. + */ + private final long dynamicLookupFunctionOnLibs(final String funcName) throws SecurityException { if(!isToolLibLoaded() || null==funcName) { if(DEBUG_LOOKUP && !isToolLibLoaded()) { System.err.println("Lookup-Native: <" + funcName + "> ** FAILED ** Tool native library not loaded"); @@ -364,7 +369,6 @@ public class DynamicLibraryBundle implements DynamicLookupHelper { @Override public final void claimAllLinkPermission() throws SecurityException { for (int i=0; i < nativeLibraries.size(); i++) { - final NativeLibrary lib = nativeLibraries.get(i); nativeLibraries.get(i).claimAllLinkPermission(); } } @@ -376,7 +380,7 @@ public class DynamicLibraryBundle implements DynamicLookupHelper { } @Override - public final long dynamicLookupFunction(final String funcName) { + public final long dynamicLookupFunction(final String funcName) throws SecurityException { if(!isToolLibLoaded() || null==funcName) { if(DEBUG_LOOKUP && !isToolLibLoaded()) { System.err.println("Lookup: <" + funcName + "> ** FAILED ** Tool native library not loaded"); @@ -404,7 +408,7 @@ public class DynamicLibraryBundle implements DynamicLookupHelper { } @Override - public final boolean isFunctionAvailable(final String funcName) { + public final boolean isFunctionAvailable(final String funcName) throws SecurityException { return 0 != dynamicLookupFunction(funcName); } diff --git a/src/java/com/jogamp/gluegen/runtime/FunctionAddressResolver.java b/src/java/com/jogamp/gluegen/runtime/FunctionAddressResolver.java index 4fc40a4..ea7cfa2 100644 --- a/src/java/com/jogamp/gluegen/runtime/FunctionAddressResolver.java +++ b/src/java/com/jogamp/gluegen/runtime/FunctionAddressResolver.java @@ -32,16 +32,20 @@ package com.jogamp.gluegen.runtime; import com.jogamp.common.os.DynamicLookupHelper; +import com.jogamp.common.util.SecurityUtil; /** - * - * @author Michael Bien + * @author Michael Bien, et.al. */ public interface FunctionAddressResolver { /** * Resolves the name of the function bound to the method and returns the address. + * <p> + * Implementation shall ensure {@link SecurityUtil#checkLinkPermission(String)} is performed. + * </p> + * @throws SecurityException if user is not granted access for the library set. */ - public long resolve(String name, DynamicLookupHelper lookup); + public long resolve(String name, DynamicLookupHelper lookup) throws SecurityException; } diff --git a/src/java/com/jogamp/gluegen/runtime/ProcAddressTable.java b/src/java/com/jogamp/gluegen/runtime/ProcAddressTable.java index d910f7b..03ed5c1 100644 --- a/src/java/com/jogamp/gluegen/runtime/ProcAddressTable.java +++ b/src/java/com/jogamp/gluegen/runtime/ProcAddressTable.java @@ -167,7 +167,6 @@ public abstract class ProcAddressTable { * @throws SecurityException if user is not granted access for all libraries. */ public void initEntry(final String name, final DynamicLookupHelper lookup) throws SecurityException, IllegalArgumentException { - SecurityUtil.checkAllLinkPermission(); final Field addressField = fieldForFunction(name); addressField.setAccessible(true); setEntry(addressField, name, lookup); @@ -176,7 +175,7 @@ public abstract class ProcAddressTable { private final void setEntry(final Field addressField, final String funcName, final DynamicLookupHelper lookup) throws SecurityException { try { assert (addressField.getType() == Long.TYPE); - final long newProcAddress = resolver.resolve(funcName, lookup); + final long newProcAddress = resolver.resolve(funcName, lookup); // issues SecurityUtil.checkLinkPermission(String) addressField.setLong(this, newProcAddress); if (DEBUG) { getDebugOutStream().println(" " + addressField.getName() + " -> 0x" + Long.toHexString(newProcAddress)); @@ -345,7 +344,7 @@ public abstract class ProcAddressTable { private static class One2OneResolver implements FunctionAddressResolver { @Override - public long resolve(final String name, final DynamicLookupHelper lookup) { + public long resolve(final String name, final DynamicLookupHelper lookup) throws SecurityException { return lookup.dynamicLookupFunction(name); } } |