Revision: 20026
          http://sourceforge.net/p/gate/code/20026
Author:   markagreenwood
Date:     2017-01-31 12:35:53 +0000 (Tue, 31 Jan 2017)
Log Message:
-----------
while mostly we use URI internally it turns out you can't resolve against a jar 
uri as it is opaque so if the URI is opaque we try and convert it to a URL and 
then resolve against that to avoid any issues

Modified Paths:
--------------
    
gate/branches/sawdust2/gate-core/src/main/java/gate/util/persistence/PersistenceManager.java

Modified: 
gate/branches/sawdust2/gate-core/src/main/java/gate/util/persistence/PersistenceManager.java
===================================================================
--- 
gate/branches/sawdust2/gate-core/src/main/java/gate/util/persistence/PersistenceManager.java
        2017-01-31 11:42:34 UTC (rev 20025)
+++ 
gate/branches/sawdust2/gate-core/src/main/java/gate/util/persistence/PersistenceManager.java
        2017-01-31 12:35:53 UTC (rev 20026)
@@ -535,7 +535,7 @@
     
     //******** Helper methods just used inside the URLHolder class
    
-    private static URI combineContextAndRelative(URI context, String relative, 
boolean contextIsFile) {
+    public static URI combineContextAndRelative(URI context, String relative, 
boolean contextIsFile) {
       // make sure we always have a proper string
       if(relative==null) relative = "";
       // we always want to interpret the part after the marker as a relative 
path, so 
@@ -563,14 +563,17 @@
         return context.resolve(".");
       } else {
         // use the URL constructor to splice the two parts together
-        /*URL tmpUrl;
-        try {
-          tmpUrl = new URL(context,relative);
-        } catch (Exception ex) {
-          throw new GateRuntimeException("Could not create a URL from context 
"+context+" and relative part "+relative,ex);
+        if (context.isOpaque()) {
+          URL tmpUrl;
+          try {
+            tmpUrl = new URL(context.toURL(),relative);
+            return tmpUrl.toURI();
+          } catch (Exception ex) {
+            throw new GateRuntimeException("Could not create a URL from 
context "+context+" and relative part "+relative,ex);
+          }
         }
-        return tmpUrl;*/
-        return context.resolve(relative);
+        
+        return context.resolve(relative).normalize();
       }
     }
     

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
GATE-cvs mailing list
GATE-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gate-cvs

Reply via email to