aboutsummaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorMichael Bien <[email protected]>2011-02-04 22:32:53 +0100
committerMichael Bien <[email protected]>2011-02-04 22:32:53 +0100
commitad554ae820ca353a1796bd750b669c1a00546341 (patch)
treed2061bd23baeba3a7716808aac9af04fa8ae4404 /src/com
parentbb3f5c6648c58ecc535b8a94fb30792b2950ca87 (diff)
initialize JOCLVersion as privileged action to be able to find trusted libraries when launched via webstart.
Diffstat (limited to 'src/com')
-rw-r--r--src/com/jogamp/opencl/util/JOCLVersion.java50
1 files changed, 40 insertions, 10 deletions
diff --git a/src/com/jogamp/opencl/util/JOCLVersion.java b/src/com/jogamp/opencl/util/JOCLVersion.java
index 181df3f5..44f32c57 100644
--- a/src/com/jogamp/opencl/util/JOCLVersion.java
+++ b/src/com/jogamp/opencl/util/JOCLVersion.java
@@ -35,12 +35,15 @@ import com.jogamp.common.GlueGenVersion;
import com.jogamp.common.os.Platform;
import com.jogamp.common.util.JogampVersion;
import com.jogamp.common.util.VersionUtil;
+import com.jogamp.opencl.CL;
+import java.security.PrivilegedAction;
import java.util.jar.Manifest;
+import static java.security.AccessController.*;
import static com.jogamp.common.util.VersionUtil.*;
/**
- *
+ * Utility for querying module versions and environment properties.
* @author Michael Bien
*/
public class JOCLVersion extends JogampVersion {
@@ -51,9 +54,16 @@ public class JOCLVersion extends JogampVersion {
super(PACKAGE, mf);
}
- private static JOCLVersion createInstance(){
- Manifest manifest = VersionUtil.getManifest(JOCLVersion.class.getClassLoader(), PACKAGE);
- return new JOCLVersion(manifest);
+ private static JOCLVersion createInstance() {
+ return doPrivileged(new PrivilegedAction<JOCLVersion>() {
+ public JOCLVersion run() {
+ Manifest manifest = VersionUtil.getManifest(CL.class.getClassLoader(), PACKAGE);
+ if(manifest == null) {
+ manifest = new Manifest();
+ }
+ return new JOCLVersion(manifest);
+ }
+ });
}
public static String getVersion() {
@@ -62,15 +72,35 @@ public class JOCLVersion extends JogampVersion {
public static String getAllVersions() {
- StringBuilder sb = new StringBuilder();
+ final StringBuilder sb = new StringBuilder();
- sb.append(SEPERATOR).append(Platform.getNewline());
- sb.append(getPlatformInfo(null));
- sb.append(SEPERATOR).append(Platform.getNewline());
+ try{
+ sb.append(SEPERATOR).append(Platform.getNewline());
+ sb.append(getPlatformInfo(null));
+ sb.append(SEPERATOR).append(Platform.getNewline());
+ }catch(Exception e) {
+ sb.append(e.getMessage());
+ e.printStackTrace();
+ }
- createInstance().toString(sb);
+ try{
+ createInstance().toString(sb);
+ }catch(Exception e) {
+ sb.append(e.getMessage());
+ e.printStackTrace();
+ }
- sb.append(GlueGenVersion.getInstance().toString());
+ try{
+ doPrivileged(new PrivilegedAction<Object>() {
+ public Object run() {
+ sb.append(GlueGenVersion.getInstance().toString());
+ return null;
+ }
+ });
+ }catch(Exception e) {
+ sb.append(e.getMessage());
+ e.printStackTrace();
+ }
return sb.toString();
}