You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(134) |
Sep
(52) |
Oct
(13) |
Nov
(342) |
Dec
(163) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(44) |
Feb
(62) |
Mar
(158) |
Apr
(38) |
May
(70) |
Jun
(58) |
Jul
(104) |
Aug
(207) |
Sep
(83) |
Oct
(122) |
Nov
(23) |
Dec
(49) |
| 2004 |
Jan
(119) |
Feb
(132) |
Mar
(192) |
Apr
(140) |
May
(77) |
Jun
(74) |
Jul
(201) |
Aug
(63) |
Sep
(102) |
Oct
(70) |
Nov
(173) |
Dec
(78) |
| 2005 |
Jan
(174) |
Feb
(197) |
Mar
(105) |
Apr
(59) |
May
(77) |
Jun
(43) |
Jul
(21) |
Aug
(18) |
Sep
(47) |
Oct
(37) |
Nov
(74) |
Dec
(50) |
| 2006 |
Jan
(44) |
Feb
(19) |
Mar
(32) |
Apr
(24) |
May
(31) |
Jun
(55) |
Jul
(138) |
Aug
(28) |
Sep
(12) |
Oct
(41) |
Nov
(58) |
Dec
(24) |
| 2007 |
Jan
(28) |
Feb
(14) |
Mar
(10) |
Apr
(68) |
May
(30) |
Jun
(26) |
Jul
(18) |
Aug
(63) |
Sep
(19) |
Oct
(29) |
Nov
(20) |
Dec
(10) |
| 2008 |
Jan
(38) |
Feb
(7) |
Mar
(37) |
Apr
(120) |
May
(41) |
Jun
(36) |
Jul
(39) |
Aug
(24) |
Sep
(28) |
Oct
(30) |
Nov
(36) |
Dec
(75) |
| 2009 |
Jan
(46) |
Feb
(22) |
Mar
(50) |
Apr
(70) |
May
(134) |
Jun
(105) |
Jul
(75) |
Aug
(34) |
Sep
(38) |
Oct
(34) |
Nov
(19) |
Dec
(20) |
| 2010 |
Jan
(11) |
Feb
(20) |
Mar
(65) |
Apr
(83) |
May
(104) |
Jun
(73) |
Jul
(78) |
Aug
(57) |
Sep
(43) |
Oct
(35) |
Nov
(9) |
Dec
(4) |
| 2011 |
Jan
(21) |
Feb
(11) |
Mar
(18) |
Apr
(10) |
May
(18) |
Jun
(15) |
Jul
(48) |
Aug
(25) |
Sep
(17) |
Oct
(45) |
Nov
(15) |
Dec
(12) |
| 2012 |
Jan
(21) |
Feb
(9) |
Mar
(12) |
Apr
(9) |
May
(9) |
Jun
(5) |
Jul
(1) |
Aug
(10) |
Sep
(12) |
Oct
(1) |
Nov
(28) |
Dec
(5) |
| 2013 |
Jan
(4) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2014 |
Jan
|
Feb
(1) |
Mar
(1) |
Apr
|
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
| 2015 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
|
| 2016 |
Jan
(2) |
Feb
(1) |
Mar
(1) |
Apr
(1) |
May
(2) |
Jun
|
Jul
(1) |
Aug
(2) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
1
|
2
|
3
(2) |
4
(15) |
5
(5) |
6
(2) |
7
|
|
8
|
9
|
10
(1) |
11
(1) |
12
(8) |
13
|
14
|
|
15
|
16
|
17
(2) |
18
(12) |
19
(6) |
20
|
21
|
|
22
(13) |
23
|
24
|
25
|
26
|
27
(2) |
28
(1) |
|
29
(4) |
30
(3) |
31
|
|
|
|
|
|
From: Elias N. <eli...@us...> - 2005-05-30 16:21:16
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10617/src/java/org/lwjgl/opengl Modified Files: Display.java GLContext.java LinuxCanvasImplementation.java MacOSXDisplay.java MacOSXFrame.java Log Message: Added AccessController.doPrivileged where needed Index: LinuxCanvasImplementation.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/LinuxCanvasImplementation.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- LinuxCanvasImplementation.java 27 May 2005 11:50:12 -0000 1.7 +++ LinuxCanvasImplementation.java 30 May 2005 16:21:04 -0000 1.8 @@ -35,6 +35,9 @@ import java.awt.GraphicsDevice; import java.lang.reflect.Method; +import java.security.AccessController; +import java.security.PrivilegedExceptionAction; + import org.lwjgl.LWJGLException; import org.lwjgl.LWJGLUtil; @@ -45,9 +48,13 @@ * @version $Revision$ */ final class LinuxCanvasImplementation implements AWTCanvasImplementation { - static int getScreenFromDevice(GraphicsDevice device) throws LWJGLException { + static int getScreenFromDevice(final GraphicsDevice device) throws LWJGLException { try { - Method getScreen_method = device.getClass().getMethod("getScreen", null); + Method getScreen_method = (Method)AccessController.doPrivileged(new PrivilegedExceptionAction() { + public Object run() throws Exception { + return device.getClass().getMethod("getScreen", null); + } + }); Integer screen = (Integer)getScreen_method.invoke(device, null); return screen.intValue(); } catch (Exception e) { @@ -55,9 +62,13 @@ } } - private static int getVisualIDFromConfiguration(GraphicsConfiguration configuration) throws LWJGLException { + private static int getVisualIDFromConfiguration(final GraphicsConfiguration configuration) throws LWJGLException { try { - Method getVisual_method = configuration.getClass().getMethod("getVisual", null); + Method getVisual_method = (Method)AccessController.doPrivileged(new PrivilegedExceptionAction() { + public Object run() throws Exception { + return configuration.getClass().getMethod("getVisual", null); + } + }); Integer visual = (Integer)getVisual_method.invoke(configuration, null); return visual.intValue(); } catch (Exception e) { Index: MacOSXFrame.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/MacOSXFrame.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- MacOSXFrame.java 18 Apr 2005 06:47:41 -0000 1.12 +++ MacOSXFrame.java 30 May 2005 16:21:04 -0000 1.13 @@ -48,6 +48,10 @@ import java.awt.event.WindowEvent; import java.awt.event.WindowListener; +import java.security.AccessController; +import java.security.PrivilegedExceptionAction; +import java.security.PrivilegedActionException; + import org.lwjgl.LWJGLException; final class MacOSXFrame extends Frame implements WindowListener, ComponentListener { @@ -62,25 +66,34 @@ private boolean minimized; private boolean should_warp_cursor; - MacOSXFrame(DisplayMode mode, java.awt.DisplayMode requested_mode, boolean fullscreen, int x, int y) throws LWJGLException { + MacOSXFrame(DisplayMode mode, final java.awt.DisplayMode requested_mode, boolean fullscreen, int x, int y) throws LWJGLException { setResizable(false); addWindowListener(this); addComponentListener(this); canvas = new MacOSXGLCanvas(); add(canvas, BorderLayout.CENTER); - boolean undecorated = Boolean.getBoolean("org.lwjgl.opengl.Window.undecorated"); + boolean undecorated = Display.getPrivilegedBoolean("org.lwjgl.opengl.Window.undecorated"); setUndecorated(fullscreen || undecorated); if ( fullscreen ) { - getDevice().setFullScreenWindow(this); - getDevice().setDisplayMode(requested_mode); - java.awt.DisplayMode real_mode = getDevice().getDisplayMode(); - /** For some strange reason, the display mode is sometimes silently capped even though the mode is reported as supported */ - if ( requested_mode.getWidth() != real_mode.getWidth() || requested_mode.getHeight() != real_mode.getHeight() ) { - getDevice().setFullScreenWindow(null); - if (isDisplayable()) - dispose(); - throw new LWJGLException("AWT capped mode: requested mode = " + requested_mode.getWidth() + "x" + requested_mode.getHeight() + - " but got " + real_mode.getWidth() + " " + real_mode.getHeight()); + try { + AccessController.doPrivileged(new PrivilegedExceptionAction() { + public Object run() throws Exception { + getDevice().setFullScreenWindow(MacOSXFrame.this); + getDevice().setDisplayMode(requested_mode); + java.awt.DisplayMode real_mode = getDevice().getDisplayMode(); + /** For some strange reason, the display mode is sometimes silently capped even though the mode is reported as supported */ + if ( requested_mode.getWidth() != real_mode.getWidth() || requested_mode.getHeight() != real_mode.getHeight() ) { + getDevice().setFullScreenWindow(null); + if (isDisplayable()) + dispose(); + throw new LWJGLException("AWT capped mode: requested mode = " + requested_mode.getWidth() + "x" + requested_mode.getHeight() + + " but got " + real_mode.getWidth() + " " + real_mode.getHeight()); + } + return null; + } + }); + } catch (PrivilegedActionException e) { + throw new LWJGLException(e); } } pack(); Index: MacOSXDisplay.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/MacOSXDisplay.java,v retrieving revision 1.31 retrieving revision 1.32 diff -u -d -r1.31 -r1.32 --- MacOSXDisplay.java 5 May 2005 11:04:17 -0000 1.31 +++ MacOSXDisplay.java 30 May 2005 16:21:04 -0000 1.32 @@ -57,6 +57,11 @@ import java.util.List; import java.util.StringTokenizer; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.security.PrivilegedExceptionAction; +import java.security.PrivilegedActionException; + import org.lwjgl.LWJGLException; import org.lwjgl.LWJGLUtil; import org.lwjgl.input.Keyboard; @@ -96,9 +101,13 @@ public void destroyWindow() { if (frame != null) { - if (MacOSXFrame.getDevice().getFullScreenWindow() == frame) - MacOSXFrame.getDevice().setFullScreenWindow(null); -// setView(null); + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + if (MacOSXFrame.getDevice().getFullScreenWindow() == frame) + MacOSXFrame.getDevice().setFullScreenWindow(null); + return null; + } + }); if (frame.isDisplayable()) frame.dispose(); frame = null; @@ -450,26 +459,24 @@ public MacOSXApplicationListener() { try { - /* Get the com.apple.eawt.Application class */ - Class com_apple_eawt_Application = Class.forName("com.apple.eawt.Application"); - /* Call the static Application.getApplication() method */ - Object application = com_apple_eawt_Application.getMethod("getApplication", null).invoke(null, null); - /* Create a proxy implementing com.apple.eawt.ApplicationListener */ - Class com_apple_eawt_ApplicationListener = Class.forName("com.apple.eawt.ApplicationListener"); - Object listener_proxy = Proxy.newProxyInstance(getClass().getClassLoader(), new Class[] {com_apple_eawt_ApplicationListener}, this); - /* Invoke the method application.addApplicationListener(proxy) */ - Method addApplicationListener = com_apple_eawt_Application.getMethod("addApplicationListener", new Class[]{com_apple_eawt_ApplicationListener}); - addApplicationListener.invoke(application, new Object[]{listener_proxy}); - /* Finally, get the handleQuit method we want to react to */ - Class com_apple_eawt_ApplicationEvent = Class.forName("com.apple.eawt.ApplicationEvent"); - handleQuit = com_apple_eawt_ApplicationListener.getMethod("handleQuit", new Class[]{com_apple_eawt_ApplicationEvent}); - } catch (InvocationTargetException e) { - throw new RuntimeException(e); - } catch (NoSuchMethodException e) { - throw new RuntimeException(e); - } catch (ClassNotFoundException e) { - throw new RuntimeException(e); - } catch (IllegalAccessException e) { + handleQuit = (Method)AccessController.doPrivileged(new PrivilegedExceptionAction() { + public Object run() throws Exception { + /* Get the com.apple.eawt.Application class */ + Class com_apple_eawt_Application = Class.forName("com.apple.eawt.Application"); + /* Call the static Application.getApplication() method */ + Object application = com_apple_eawt_Application.getMethod("getApplication", null).invoke(null, null); + /* Create a proxy implementing com.apple.eawt.ApplicationListener */ + Class com_apple_eawt_ApplicationListener = Class.forName("com.apple.eawt.ApplicationListener"); + Object listener_proxy = Proxy.newProxyInstance(getClass().getClassLoader(), new Class[] {com_apple_eawt_ApplicationListener}, MacOSXApplicationListener.this); + /* Invoke the method application.addApplicationListener(proxy) */ + Method addApplicationListener = com_apple_eawt_Application.getMethod("addApplicationListener", new Class[]{com_apple_eawt_ApplicationListener}); + addApplicationListener.invoke(application, new Object[]{listener_proxy}); + /* Finally, get the handleQuit method we want to react to */ + Class com_apple_eawt_ApplicationEvent = Class.forName("com.apple.eawt.ApplicationEvent"); + return com_apple_eawt_ApplicationListener.getMethod("handleQuit", new Class[]{com_apple_eawt_ApplicationEvent}); + } + }); + } catch (PrivilegedActionException e) { throw new RuntimeException(e); } } Index: Display.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/Display.java,v retrieving revision 1.50 retrieving revision 1.51 diff -u -d -r1.50 -r1.51 --- Display.java 6 May 2005 09:40:36 -0000 1.50 +++ Display.java 30 May 2005 16:21:04 -0000 1.51 @@ -47,6 +47,9 @@ import java.util.Arrays; import java.util.HashSet; +import java.security.AccessController; +import java.security.PrivilegedAction; + import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLException; import org.lwjgl.LWJGLUtil; @@ -98,9 +101,14 @@ try { current_mode = initial_mode = display_impl.init(); LWJGLUtil.log("Initial mode: " + initial_mode); - Runtime.getRuntime().addShutdownHook(new Thread() { - public void run() { - reset(); + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + Runtime.getRuntime().addShutdownHook(new Thread() { + public void run() { + reset(); + } + }); + return null; } }); } catch (LWJGLException e) { @@ -656,10 +664,22 @@ return display_impl; } + /** + * Gets a boolean property as a privileged action. + */ + static boolean getPrivilegedBoolean(final String property_name) { + Boolean value = (Boolean)AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + return new Boolean(Boolean.getBoolean(property_name)); + } + }); + return value.booleanValue(); + } + private static void initControls() { // Automatically create mouse, keyboard and controller - if (!Boolean.getBoolean("org.lwjgl.opengl.Display.noinput")) { - if (!Mouse.isCreated() && !Boolean.getBoolean("org.lwjgl.opengl.Display.nomouse")) { + if (!getPrivilegedBoolean("org.lwjgl.opengl.Display.noinput")) { + if (!Mouse.isCreated() && !getPrivilegedBoolean("org.lwjgl.opengl.Display.nomouse")) { try { Mouse.create(); } catch (LWJGLException e) { @@ -670,7 +690,7 @@ } } } - if (!Keyboard.isCreated() && !Boolean.getBoolean("org.lwjgl.opengl.Display.nokeyboard")) { + if (!Keyboard.isCreated() && !getPrivilegedBoolean("org.lwjgl.opengl.Display.nokeyboard")) { try { Keyboard.create(); } catch (LWJGLException e) { Index: GLContext.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/GLContext.java,v retrieving revision 1.50 retrieving revision 1.51 diff -u -d -r1.50 -r1.51 --- GLContext.java 4 May 2005 20:59:36 -0000 1.50 +++ GLContext.java 30 May 2005 16:21:04 -0000 1.51 @@ -38,6 +38,11 @@ import java.util.StringTokenizer; import java.util.WeakHashMap; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; + import org.lwjgl.LWJGLException; import org.lwjgl.LWJGLUtil; import org.lwjgl.Sys; @@ -93,7 +98,11 @@ * with a name dependent on the current platform */ static long getPlatformSpecificFunctionAddress(String function_prefix, String[] os_prefixes, String[] os_function_prefixes, String function) { - String os_name = System.getProperty("os.name"); + String os_name = (String)AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + return System.getProperty("os.name"); + } + }); for (int i = 0; i < os_prefixes.length; i++) if (os_name.startsWith(os_prefixes[i])) { String platform_function_name = function.replaceFirst(function_prefix, os_function_prefixes[i]); @@ -167,12 +176,17 @@ * Helper method to ContextCapabilities. It will try to initialize the native stubs, * and remove the given extension name from the extension set if the initialization fails. */ - static void initNativeStubs(Class extension_class, Set supported_extensions, String ext_name) { + static void initNativeStubs(final Class extension_class, Set supported_extensions, String ext_name) { resetNativeStubs(extension_class); if (supported_extensions.contains(ext_name)) { try { - Method init_stubs_method = extension_class.getDeclaredMethod("initNativeStubs", null); - init_stubs_method.invoke(null, null); + AccessController.doPrivileged(new PrivilegedExceptionAction() { + public Object run() throws Exception { + Method init_stubs_method = extension_class.getDeclaredMethod("initNativeStubs", null); + init_stubs_method.invoke(null, null); + return null; + } + }); } catch (Exception e) { LWJGLUtil.log("Failed to initialize extension " + extension_class + " - exception: " + e); supported_extensions.remove(ext_name); |
|
From: Elias N. <eli...@us...> - 2005-05-30 16:21:14
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10617/src/native/common Modified Files: common_tools.c Log Message: Added AccessController.doPrivileged where needed Index: common_tools.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/common_tools.c,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- common_tools.c 18 May 2005 21:02:41 -0000 1.24 +++ common_tools.c 30 May 2005 16:21:05 -0000 1.25 @@ -314,9 +314,9 @@ bool getBooleanProperty(JNIEnv *env, const char* propertyName) { jstring property = NewStringNative(env, propertyName); - jclass booleanClass = (*env)->FindClass(env, "java/lang/Boolean"); - jmethodID getBoolean = (*env)->GetStaticMethodID(env, booleanClass, "getBoolean", "(Ljava/lang/String;)Z"); - return (*env)->CallStaticBooleanMethod(env, booleanClass, getBoolean, property) ? true : false; + jclass org_lwjgl_LWJGLUtil_class = (*env)->FindClass(env, "org/lwjgl/LWJGLUtil"); + jmethodID getBoolean = (*env)->GetStaticMethodID(env, org_lwjgl_LWJGLUtil_class, "getPrivilegedBoolean", "(Ljava/lang/String;)Z"); + return (*env)->CallStaticBooleanMethod(env, org_lwjgl_LWJGLUtil_class, getBoolean, property) ? true : false; } JavaVM *getJVM() { |
|
From: Elias N. <eli...@us...> - 2005-05-30 16:21:13
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10617/src/java/org/lwjgl Modified Files: LWJGLUtil.java LinuxSysImplementation.java MacOSXSysImplementation.java Sys.java Log Message: Added AccessController.doPrivileged where needed Index: LinuxSysImplementation.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/LinuxSysImplementation.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- LinuxSysImplementation.java 23 Feb 2005 11:22:14 -0000 1.4 +++ LinuxSysImplementation.java 30 May 2005 16:21:03 -0000 1.5 @@ -33,6 +33,10 @@ import java.io.IOException; +import java.security.AccessController; +import java.security.PrivilegedExceptionAction; +import java.security.PrivilegedActionException; + /** * $Id$ * @@ -44,17 +48,23 @@ java.awt.Toolkit.getDefaultToolkit(); // This will make sure libjawt.so is loaded } - public boolean openURL(String url) { + public boolean openURL(final String url) { // Linux may as well resort to pure Java hackery, as there's no Linux native way of doing it // right anyway. String[] browsers = {"firefox", "mozilla", "opera", "konqueror", "nautilus", "galeon", "netscape"}; for (int i = 0; i < browsers.length; i ++) { + final String browser = browsers[i]; try { - Runtime.getRuntime().exec(new String[] { browsers[i], url }); + AccessController.doPrivileged(new PrivilegedExceptionAction() { + public Object run() throws Exception { + Runtime.getRuntime().exec(new String[] { browser, url }); + return null; + } + }); return true; - } catch (IOException e) { + } catch (PrivilegedActionException e) { // Ignore e.printStackTrace(System.err); } Index: MacOSXSysImplementation.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/MacOSXSysImplementation.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- MacOSXSysImplementation.java 20 Jan 2005 22:51:26 -0000 1.2 +++ MacOSXSysImplementation.java 30 May 2005 16:21:03 -0000 1.3 @@ -33,6 +33,9 @@ import java.lang.reflect.Method; +import java.security.AccessController; +import java.security.PrivilegedExceptionAction; + /** * $Id$ * @@ -42,11 +45,21 @@ class MacOSXSysImplementation extends J2SESysImplementation { public boolean openURL(String url) { try { - Class com_apple_eio_FileManager = Class.forName("com.apple.eio.FileManager"); - Method openURL_method = com_apple_eio_FileManager.getMethod("openURL", new Class[]{String.class}); + Method openURL_method = (Method)AccessController.doPrivileged(new PrivilegedExceptionAction() { + public Object run() throws Exception { + try { + Class com_apple_eio_FileManager = Class.forName("com.apple.eio.FileManager"); + return com_apple_eio_FileManager.getMethod("openURL", new Class[]{String.class}); + } catch (Exception e) { + LWJGLUtil.log("Exception occurred while trying to invoke browser: " + e); + return null; + } + } + }); openURL_method.invoke(null, new Object[]{url}); return true; } catch (Exception e) { + LWJGLUtil.log("Exception occurred while trying to invoke browser: " + e); return false; } } Index: LWJGLUtil.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/LWJGLUtil.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- LWJGLUtil.java 12 May 2005 07:47:06 -0000 1.5 +++ LWJGLUtil.java 30 May 2005 16:21:03 -0000 1.6 @@ -37,6 +37,11 @@ import java.util.List; import java.util.StringTokenizer; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; + /** * $Id$ * <p> @@ -52,8 +57,8 @@ public static final int PLATFORM_WINDOWS = 3; /** Debug flag. */ - public static final boolean DEBUG = Boolean.getBoolean("org.lwjgl.util.Debug"); - + public static final boolean DEBUG = getPrivilegedBoolean("org.lwjgl.util.Debug"); + /** * Get the current platform */ @@ -102,15 +107,15 @@ throw new LWJGLException("Unknown platform: " + getPlatform()); } - String classloader_path = LWJGLUtil.getPathFromClassLoader(libname, classloader); + String classloader_path = getPathFromClassLoader(libname, classloader); if (classloader_path != null) { - LWJGLUtil.log("getPathFromClassLoader: Path found: " + classloader_path); + log("getPathFromClassLoader: Path found: " + classloader_path); possible_paths.add(classloader_path); } - String lwjgl_classloader_path = LWJGLUtil.getPathFromClassLoader("lwjgl", classloader); + String lwjgl_classloader_path = getPathFromClassLoader("lwjgl", classloader); if (lwjgl_classloader_path != null) { - LWJGLUtil.log("getPathFromClassLoader: Path found: " + lwjgl_classloader_path); + log("getPathFromClassLoader: Path found: " + lwjgl_classloader_path); possible_paths.add(lwjgl_classloader_path.substring(0, lwjgl_classloader_path.lastIndexOf(File.separator)) + File.separator + platform_lib_name); } @@ -119,7 +124,12 @@ possible_paths.add(platform_lib_name); // Add all possible paths from java.library.path - StringTokenizer st = new StringTokenizer(System.getProperty("java.library.path"), File.pathSeparator); + String java_library_path = (String)AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + return System.getProperty("java.library.path"); + } + }); + StringTokenizer st = new StringTokenizer(java_library_path, File.pathSeparator); while (st.hasMoreTokens()) { String path = st.nextToken(); possible_paths.add(path + File.separator + platform_lib_name); @@ -145,32 +155,51 @@ */ public static String getPathFromClassLoader(String libname, ClassLoader classloader) { try { - LWJGLUtil.log("getPathFromClassLoader: searching for: " + libname); + log("getPathFromClassLoader: searching for: " + libname); Object o = classloader; Class c = o.getClass(); while (c != null) { + final Class clazz = c; try { - Method findLibrary = c.getDeclaredMethod("findLibrary", new Class[] { String.class}); - findLibrary.setAccessible(true); + Method findLibrary = (Method)AccessController.doPrivileged(new PrivilegedExceptionAction() { + public Object run() throws Exception { + Method m = clazz.getDeclaredMethod("findLibrary", new Class[]{String.class}); + m.setAccessible(true); + return m; + } + }); Object[] arguments = new Object[] {libname}; - return (String) findLibrary.invoke(o, arguments); - } catch (NoSuchMethodException e) { + return (String)findLibrary.invoke(o, arguments); + } catch (PrivilegedActionException e) { c = c.getSuperclass(); } } } catch (Exception e) { - LWJGLUtil.log("Failure locating " + e + " using classloader:" + e); + log("Failure locating " + e + " using classloader:" + e); } return null; } /** + * Gets a boolean property as a privileged action. Helper method + * for native. + */ + private static boolean getPrivilegedBoolean(final String property_name) { + Boolean value = (Boolean)AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + return new Boolean(Boolean.getBoolean(property_name)); + } + }); + return value.booleanValue(); + } + + /** * Prints the given message to System.err if DEBUG is true. * * @param msg Message to print */ public static void log(String msg) { - if (LWJGLUtil.DEBUG) { + if (DEBUG) { System.err.println(msg); } } Index: Sys.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/Sys.java,v retrieving revision 1.86 retrieving revision 1.87 diff -u -d -r1.86 -r1.87 --- Sys.java 18 May 2005 21:01:15 -0000 1.86 +++ Sys.java 30 May 2005 16:21:03 -0000 1.87 @@ -37,6 +37,10 @@ import org.lwjgl.input.Mouse; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.security.PrivilegedExceptionAction; + /** * $Id$ * <p> @@ -58,7 +62,12 @@ static { implementation = createImplementation(); - System.loadLibrary(LIBRARY_NAME); + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + System.loadLibrary(LIBRARY_NAME); + return null; + } + }); String native_version = implementation.getNativeLibraryVersion(); if (!native_version.equals(VERSION)) throw new LinkageError("Version mismatch: jar version is '" + VERSION + @@ -176,11 +185,19 @@ // Attempt to use Webstart if we have it available try { // Lookup the javax.jnlp.BasicService object - Class serviceManagerClass = Class.forName("javax.jnlp.ServiceManager"); - Method lookupMethod = serviceManagerClass.getMethod("lookup", new Class[] {String.class}); + final Class serviceManagerClass = Class.forName("javax.jnlp.ServiceManager"); + Method lookupMethod = (Method)AccessController.doPrivileged(new PrivilegedExceptionAction() { + public Object run() throws Exception { + return serviceManagerClass.getMethod("lookup", new Class[] {String.class}); + } + }); Object basicService = lookupMethod.invoke(serviceManagerClass, new Object[] {"javax.jnlp.BasicService"}); - Class basicServiceClass = Class.forName("javax.jnlp.BasicService"); - Method showDocumentMethod = basicServiceClass.getMethod("showDocument", new Class[] {URL.class}); + final Class basicServiceClass = Class.forName("javax.jnlp.BasicService"); + Method showDocumentMethod = (Method)AccessController.doPrivileged(new PrivilegedExceptionAction() { + public Object run() throws Exception { + return basicServiceClass.getMethod("showDocument", new Class[] {URL.class}); + } + }); try { Boolean ret = (Boolean) showDocumentMethod.invoke(basicService, new Object[] {new URL(url)}); return ret.booleanValue(); |