Revision: 5279
          http://sourceforge.net/p/jump-pilot/code/5279
Author:   edso
Date:     2016-12-27 18:06:15 +0000 (Tue, 27 Dec 2016)
Log Message:
-----------
fix sextante init when url is "jar:..!" wrapped

Modified Paths:
--------------
    
plug-ins/SextantePlugIn/src/es/unex/sextante/openjump/extensions/SextanteExtension.java

Modified: 
plug-ins/SextantePlugIn/src/es/unex/sextante/openjump/extensions/SextanteExtension.java
===================================================================
--- 
plug-ins/SextantePlugIn/src/es/unex/sextante/openjump/extensions/SextanteExtension.java
     2016-12-27 17:55:49 UTC (rev 5278)
+++ 
plug-ins/SextantePlugIn/src/es/unex/sextante/openjump/extensions/SextanteExtension.java
     2016-12-27 18:06:15 UTC (rev 5279)
@@ -1,6 +1,7 @@
 package es.unex.sextante.openjump.extensions;
 
 import java.io.File;
+import java.net.JarURLConnection;
 import java.net.URL;
 
 import com.vividsolutions.jump.workbench.Logger;
@@ -57,19 +58,26 @@
     URL sextGUIJarUrl = SextanteGUI.class.getProtectionDomain().getCodeSource()
         .getLocation();
     Logger.debug("SextanteGUI claims to be in " + sextGUIJarUrl);
-    File sextDir = null;
+
     if (sextGUIJarUrl == null) {
       Logger.error("Location of SextanteGUI is null.");
       return;
     }
 
-    File sextGUIJarFile = new File(sextGUIJarUrl.getFile());
+    // strip possible "jar:<file:\path\to\sextante_gui.jar>!.." wrapping
+    if (sextGUIJarUrl.getProtocol().equalsIgnoreCase("jar")){
+      JarURLConnection connection =
+          (JarURLConnection) sextGUIJarUrl.openConnection();
+      sextGUIJarUrl = connection.getJarFileURL();
+    }
+
+    File sextGUIJarFile = new File(sextGUIJarUrl.getPath());
     if (!sextGUIJarFile.isFile()) {
       Logger.error(sextGUIJarFile + " is not a file!");
       return;
     }
 
-    sextDir = sextGUIJarFile.getParentFile();
+    File sextDir = sextGUIJarFile.getParentFile();
     if (!sextDir.isDirectory()) {
       Logger.error("Sextante folder " + sextDir + " is not a folder!");
       return;


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Jump-pilot-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to