diff options
author | Sven Gothel <[email protected]> | 2011-02-09 03:53:21 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-02-09 03:53:21 +0100 |
commit | b014a46d18d593136640c928f790494fc33a6d1e (patch) | |
tree | 3826ed124a66145bc3035873be55ef03dbb0d771 /make | |
parent | eafc9a55cd9ba31709bc45aebd063ff8c2c7d781 (diff) |
Add privileged decoration around library loading
Diffstat (limited to 'make')
-rw-r--r-- | make/joal-common-CustomJavaCode.java | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/make/joal-common-CustomJavaCode.java b/make/joal-common-CustomJavaCode.java index 61c6d0c..6f77146 100644 --- a/make/joal-common-CustomJavaCode.java +++ b/make/joal-common-CustomJavaCode.java @@ -2,21 +2,27 @@ static final DynamicLibraryBundle alDynamicLookupHelper; private static final ALProcAddressTable alProcAddressTable; static { - alProcAddressTable = new ALProcAddressTable(); - if(null==alProcAddressTable) { - throw new RuntimeException("Couldn't instantiate ALProcAddressTable"); - } - alDynamicLookupHelper = new DynamicLibraryBundle(new ALDynamicLibraryBundleInfo()); - if(null==alDynamicLookupHelper) { - throw new RuntimeException("Null ALDynamicLookupHelper"); - } - if(!alDynamicLookupHelper.isToolLibLoaded()) { - throw new RuntimeException("Couln't load native AL library"); - } - if(!alDynamicLookupHelper.isLibComplete()) { - throw new RuntimeException("Couln't load native AL/JNI glue library"); - } - alProcAddressTable.reset(alDynamicLookupHelper); + alProcAddressTable = new ALProcAddressTable(); + if(null==alProcAddressTable) { + throw new RuntimeException("Couldn't instantiate ALProcAddressTable"); + } + + alDynamicLookupHelper = (DynamicLibraryBundle) + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + return new DynamicLibraryBundle(new ALDynamicLibraryBundleInfo()); + } + }); + if(null==alDynamicLookupHelper) { + throw new RuntimeException("Null ALDynamicLookupHelper"); + } + if(!alDynamicLookupHelper.isToolLibLoaded()) { + throw new RuntimeException("Couln't load native AL library"); + } + if(!alDynamicLookupHelper.isLibComplete()) { + throw new RuntimeException("Couln't load native AL/JNI glue library"); + } + alProcAddressTable.reset(alDynamicLookupHelper); } public static ALProcAddressTable getALProcAddressTable() { return alProcAddressTable; } |