vhardy 02/05/17 02:20:03 Modified: sources/org/apache/batik/apps/svgbrowser JSVGViewerFrame.java Log: Fixed FileOpen dialog issue on JDK 1.4, where the recommended security work around for 1.3 causes a security exception ..... The fix is JDK version dependant. Revision Changes Path 1.77 +30 -3 xml-batik/sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java Index: JSVGViewerFrame.java =================================================================== RCS file: /home/cvs/xml-batik/sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java,v retrieving revision 1.76 retrieving revision 1.77 diff -u -r1.76 -r1.77 --- JSVGViewerFrame.java 2 May 2002 09:24:16 -0000 1.76 +++ JSVGViewerFrame.java 17 May 2002 09:20:03 -0000 1.77 @@ -165,7 +165,7 @@ * This class represents a SVG viewer swing frame. * * @author <a href="mailto:[EMAIL PROTECTED]">Stephane Hillion</a> - * @version $Id: JSVGViewerFrame.java,v 1.76 2002/05/02 09:24:16 vhardy Exp $ + * @version $Id: JSVGViewerFrame.java,v 1.77 2002/05/17 09:20:03 vhardy Exp $ */ public class JSVGViewerFrame extends JFrame @@ -178,6 +178,31 @@ UpdateManagerListener { /** + * Kind of ugly, but we need to know if we are running before + * or after 1.4... + */ + protected static boolean priorJDK1_4 = true; + + /** + * If the following class can be found (it appeared in JDK 1.4), + * then we know we are post JDK 1.4. + */ + protected static final String JDK_1_4_PRESENCE_TEST_CLASS + = "java.util.logging.LoggingPermission"; + + static { + Class cl = null; + try { + cl = Class.forName(JDK_1_4_PRESENCE_TEST_CLASS); + } catch (ClassNotFoundException e){ + } + + if (cl != null) { + priorJDK1_4 = false; + } + } + + /** * The gui resources file name */ public final static String RESOURCES = @@ -723,10 +748,12 @@ public void actionPerformed(ActionEvent e) { JFileChooser fileChooser = null; - // Apply work around Windows problem when security is enabled + // Apply work around Windows problem when security is enabled, + // and when prior to JDK 1.4. String os = System.getProperty(PROPERTY_OS_NAME, PROPERTY_OS_NAME_DEFAULT); SecurityManager sm = System.getSecurityManager(); - if ( sm != null && os.indexOf(PROPERTY_OS_WINDOWS_PREFIX) != -1 ){ + + if ( priorJDK1_4 && sm != null && os.indexOf(PROPERTY_OS_WINDOWS_PREFIX) != -1 ){ fileChooser = new JFileChooser(makeAbsolute(currentPath), new WindowsAltFileSystemView()); } else {
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]