Revision: 15009
          http://gate.svn.sourceforge.net/gate/?rev=15009&view=rev
Author:   adamfunk
Date:     2012-01-11 12:46:43 +0000 (Wed, 11 Jan 2012)
Log Message:
-----------
Using url.getPath() because it works in jar URLs, but then using URI
as well in order to decode %STUFF (patch suggested by Ian).

Modified Paths:
--------------
    gate/trunk/src/gate/Gate.java

Modified: gate/trunk/src/gate/Gate.java
===================================================================
--- gate/trunk/src/gate/Gate.java       2012-01-11 10:19:37 UTC (rev 15008)
+++ gate/trunk/src/gate/Gate.java       2012-01-11 12:46:43 UTC (rev 15009)
@@ -1348,9 +1348,9 @@
     public String getName() {
       if(name != null) return name;
 
-      name = "";
+      // url.getPath() works for jar URLs; url.toURI().getPath() doesn't
+      // because jars aren't considered "hierarchical"
       name = url.getPath();
-
       if(name.endsWith("/")) {
         name = name.substring(0, name.length() - 1);
       }
@@ -1358,7 +1358,13 @@
       if(lastSlash != -1) {
         name = name.substring(lastSlash + 1);
       }
-
+      try {
+        // convert to (relative) URI and extract path.  This will
+        // decode any %20 escapes in the name.
+        name = new URI(name).getPath();
+      } catch(URISyntaxException ex) {
+        // ignore, this should have been checked when adding the URL!
+      }
       return name;
     }
     

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


------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual 
desktops for less than the cost of PCs and save 60% on VDI infrastructure 
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs

Reply via email to