You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by mu...@apache.org on 2023/03/11 13:02:22 UTC

[xalan-test] branch master updated: fix for the SystemIDResolverAPITest, with inputs from Joseph Kessselman

This is an automated email from the ASF dual-hosted git repository.

mukulg pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/xalan-test.git


The following commit(s) were added to refs/heads/master by this push:
     new ca59c21d fix for the SystemIDResolverAPITest, with inputs from Joseph Kessselman
ca59c21d is described below

commit ca59c21d76f5a7836fbfb8b25d9e37649a212679
Author: Mukul Gandhi <ga...@gmail.com>
AuthorDate: Sat Mar 11 18:32:00 2023 +0530

    fix for the SystemIDResolverAPITest, with inputs from Joseph Kessselman
---
 .../qetest/xalanj2/SystemIDResolverAPITest.java    | 37 ++++++++++------------
 1 file changed, 17 insertions(+), 20 deletions(-)

diff --git a/java/src/org/apache/qetest/xalanj2/SystemIDResolverAPITest.java b/java/src/org/apache/qetest/xalanj2/SystemIDResolverAPITest.java
index c493aaf6..6d7c8024 100644
--- a/java/src/org/apache/qetest/xalanj2/SystemIDResolverAPITest.java
+++ b/java/src/org/apache/qetest/xalanj2/SystemIDResolverAPITest.java
@@ -28,7 +28,8 @@ import org.apache.xml.utils.SystemIDResolver;
  *
  * Very simple coverage test.
  * 
- * @author shane_curcuru@us.ibm.com
+ * @author shane_curcuru@us.ibm.com,
+ *         Joe Kesselman  
  * @version $Id$
  */
 public class SystemIDResolverAPITest extends FileBasedTest
@@ -112,27 +113,23 @@ public class SystemIDResolverAPITest extends FileBasedTest
         {
             String prevUserDir = System.getProperty("user.dir");
             String baseURL = prevUserDir.replace('\\', '/');
-            if (null == baseURL)
-                baseURL = "";
+            if (baseURL == null) {
+               baseURL = "";
+            }
 
-            // Add the default file scheme and a separator between 
-            // the (blank) authority component and the hierarchical 
-            // pathing component
-            baseURL = FILE_SCHEME + URL_SEP + baseURL + URL_SEP;
+            // To turn a posix user.dir into a filesystem URL, prefix it with
+            // FILE_SCHEME (normally with a blank authority component) and
+            // follow it with URL_SEP to ensure it is taken as a directory.
+            //
+            // HOWEVER: On Windows, where absolute paths begin with a drive letter rather
+            // than the root-directory URL_SEP, XalanJ is expected to insert a URL_SEP
+            // between the scheme and user.dir, so the baseURI always starts with
+            // "file:///".
+            if (baseURL.length() > 0 && baseURL.charAt(0) != '/') {
+               baseURL = URL_SEP + baseURL;
+            }               
             
-            /*String osName = (System.getProperty("os.name")).toUpperCase();
-            if (osName != null) {
-               if (osName.contains("WINDOWS")) {
-                  baseURL = FILE_SCHEME + URL_SEP + baseURL + URL_SEP;
-               } else if (osName.contains("LINUX")) {
-                  baseURL = FILE_SCHEME + baseURL + URL_SEP;
-               } else {
-                  baseURL = FILE_SCHEME + baseURL + URL_SEP;
-               }
-            } 
-            else {
-               baseURL = FILE_SCHEME + URL_SEP + baseURL + URL_SEP;
-            }*/
+            baseURL = FILE_SCHEME + baseURL + URL_SEP;
 
             reporter.logStatusMsg("user.dir baseURI is: " + baseURL);
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xalan.apache.org
For additional commands, e-mail: commits-help@xalan.apache.org