You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by cu...@apache.org on 2001/05/20 02:56:01 UTC
cvs commit: xml-xalan/java/src/org/apache/xml/utils TreeWalker.java SystemIDResolver.java
curcuru 01/05/19 17:56:01
Modified: java/src/org/apache/xml/utils TreeWalker.java
SystemIDResolver.java
Log:
Catch SecurityException whenever accessing System.getProperty("user.dir");
minor javadoc update
Revision Changes Path
1.11 +39 -3 xml-xalan/java/src/org/apache/xml/utils/TreeWalker.java
Index: TreeWalker.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/utils/TreeWalker.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- TreeWalker.java 2001/04/11 16:02:22 1.10
+++ TreeWalker.java 2001/05/20 00:56:00 1.11
@@ -109,7 +109,20 @@
if (systemId != null)
m_locator.setSystemId(systemId);
else
- m_locator.setSystemId(System.getProperty("user.dir"));
+ {
+ try
+ {
+ m_locator.setSystemId(System.getProperty("user.dir"));
+ }
+ catch (SecurityException se)
+ {
+ // Must catch this for applet case -sc
+ // Um, set default to '.', for lack of a better idea?
+ // This may well not work, but it's probably better
+ // than just propagating the SecurityException
+ m_locator.setSystemId(".");
+ }
+ }
m_dh = dh;
}
@@ -122,7 +135,19 @@
{
this.m_contentHandler = contentHandler;
m_contentHandler.setDocumentLocator(m_locator);
- m_locator.setSystemId(System.getProperty("user.dir"));
+ try
+ {
+ m_locator.setSystemId(System.getProperty("user.dir"));
+ }
+ catch (SecurityException se)
+ {
+ // Must catch this for applet case -sc
+ // Um, set default to '.', for lack of a better idea?
+ // This may well not work, but it's probably better
+ // than just propagating the SecurityException
+ m_locator.setSystemId(".");
+ }
+
m_dh = dh;
}
@@ -135,7 +160,18 @@
{
this.m_contentHandler = contentHandler;
m_contentHandler.setDocumentLocator(m_locator);
- m_locator.setSystemId(System.getProperty("user.dir"));
+ try
+ {
+ m_locator.setSystemId(System.getProperty("user.dir"));
+ }
+ catch (SecurityException se)
+ {
+ // Must catch this for applet case -sc
+ // Um, set default to '.', for lack of a better idea?
+ // This may well not work, but it's probably better
+ // than just propagating the SecurityException
+ m_locator.setSystemId(".");
+ }
m_dh = new org.apache.xpath.DOM2Helper();
}
1.8 +18 -13 xml-xalan/java/src/org/apache/xml/utils/SystemIDResolver.java
Index: SystemIDResolver.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/utils/SystemIDResolver.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- SystemIDResolver.java 2001/03/11 21:47:46 1.7
+++ SystemIDResolver.java 2001/05/20 00:56:00 1.8
@@ -61,10 +61,7 @@
import org.apache.xml.utils.URI;
import org.apache.xml.utils.URI.MalformedURIException;
-import java.io.*;
-import java.lang.StringBuffer;
-
/**
* <meta name="usage" content="internal"/>
* This class is used to resolve relative URIs and SystemID
@@ -75,8 +72,10 @@
/**
* Get absolute URI from a given relative URI.
- * The URI is resolved relative to the system property "user.dir"
- *
+ * The URI is resolved relative to the system property
+ * "user.dir" if it is available; if not the input URI
+ * is returned as-is with backslashes turned into
+ * forward slashes (as required for URIs).
*
* @param uri Relative URI to resolve
*
@@ -85,15 +84,21 @@
*/
public static String getAbsoluteURIFromRelative(String uri)
{
-
- String curdir = System.getProperty("user.dir");
-
+ String curdir = null;
+ try
+ {
+ curdir = System.getProperty("user.dir");
+ }
+ catch (SecurityException se)
+ {
+ // No-op for Applet/sandbox cases -sc 18-May-01
+ }
if (null != curdir)
{
- if (uri != null)
- uri = "file:///" + curdir + System.getProperty("file.separator") + uri;
- else
- uri = "file:///" + curdir + System.getProperty("file.separator");
+ if (uri != null)
+ uri = "file:///" + curdir + System.getProperty("file.separator") + uri;
+ else
+ uri = "file:///" + curdir + System.getProperty("file.separator");
}
if (null != uri && (uri.indexOf('\\') > -1))
@@ -165,7 +170,7 @@
if (null != urlString && (urlString.indexOf('\\') > -1))
urlString = urlString.replace('\\', '/');
- URI uri;
+ URI uri; // is-a org.apache.xml.utils.URI -sc
try
{
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org