Rodolfo Ochoa has proposed merging lp:~zorba-coders/zorba/bug925816 into 
lp:zorba.

Requested reviews:
  Matthias Brantner (matthias-brantner)
  Cezar Andrei (cezar-andrei)
  Rodolfo Ochoa (rodolfo-ochoa)
Related bugs:
  Bug #925816 in Zorba: "URI resolver doesn't support Java URI format"
  https://bugs.launchpad.net/zorba/+bug/925816

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/bug925816/+merge/91382

Added recognition for URIs without authority, this is a JAVA URI case.
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug925816/+merge/91382
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/zorbatypes/URI.cpp'
--- src/zorbatypes/URI.cpp	2011-12-21 14:40:33 +0000
+++ src/zorbatypes/URI.cpp	2012-02-03 01:31:20 +0000
@@ -99,6 +99,18 @@
     zstring tmp(uri.c_str() + 8);
     uri::decode(tmp, &filepath);
   }
+  else if (uri.compare(0, 6, "file:/") == 0 && //JAVA Exception for File URIs without Authority
+          ((uri.compare(7, 1, ":") == 0) || (uri.compare(7, 4, "%3A/") == 0))) 
+  {
+    zstring tmp(uri.c_str() + 6);
+    uri::decode(tmp, &filepath);
+  }
+  else if (uri.compare(0, 17, "file://localhost/") == 0 && 
+      ((uri.compare(18, 1, ":") == 0) || (uri.compare(18, 4, "%3A/") == 0))) 
+  {
+    zstring tmp(uri.c_str() + 17);
+    uri::decode(tmp, &filepath);
+  }
   else
 #endif
     if (uri.compare(0, 8, "file:///") == 0) 
@@ -621,9 +633,13 @@
    * Authority
    * two slashes means generic URI syntax, so we get the authority
    */
-  if (lTrimmedURI.compare(lIndex, 2, "//") == 0) 
+  if ( (lTrimmedURI.compare(lIndex, 2, "//") == 0) ||
+        // allow JAVA FILE constructs without authority, i.e.: file:/D:/myFile 
+       (ZSTREQ(theScheme, "file") && (lTrimmedURI.compare(lIndex, 1, "/") == 0)))
   {
-    lIndex += 2;
+    if ((lTrimmedURI.compare(lIndex, 2, "//") == 0)) {
+      lIndex += 2;
+    }
     if (lIndex >= lTrimmedURILength)
     {
       throw XQUERY_EXCEPTION(

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to     : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp

Reply via email to