Author: rickhall
Date: Thu May  8 12:35:03 2008
New Revision: 654601

URL: http://svn.apache.org/viewvc?rev=654601&view=rev
Log:
Modified "update" command to not append ".jar" to URLs and also modified the
"install" command to use the same code. (FELIX-544)

Modified:
    
felix/trunk/shell/src/main/java/org/apache/felix/shell/impl/InstallCommandImpl.java
    
felix/trunk/shell/src/main/java/org/apache/felix/shell/impl/UpdateCommandImpl.java

Modified: 
felix/trunk/shell/src/main/java/org/apache/felix/shell/impl/InstallCommandImpl.java
URL: 
http://svn.apache.org/viewvc/felix/trunk/shell/src/main/java/org/apache/felix/shell/impl/InstallCommandImpl.java?rev=654601&r1=654600&r2=654601&view=diff
==============================================================================
--- 
felix/trunk/shell/src/main/java/org/apache/felix/shell/impl/InstallCommandImpl.java
 (original)
+++ 
felix/trunk/shell/src/main/java/org/apache/felix/shell/impl/InstallCommandImpl.java
 Thu May  8 12:35:03 2008
@@ -19,6 +19,7 @@
 package org.apache.felix.shell.impl;
 
 import java.io.PrintStream;
+import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.StringTokenizer;
 
@@ -127,10 +128,11 @@
 
     private String absoluteLocation(String location)
     {
-        String guess = location;
-        // If the location does not contain a ":", then try to
-        // add the base URL from the 'cd' command service.
-        if (location.indexOf(':') < 0)
+        try
+        {
+            new URL(location);
+        }
+        catch (MalformedURLException ex)
         {
             // Try to create a valid URL using the base URL
             // contained in the "cd" command service.
@@ -150,16 +152,15 @@
                     m_context.ungetService(ref);
                 }
 
-                String theURL = baseURL + guess;
+                String theURL = baseURL + location;
                 new URL(theURL);
+                location = theURL;
             }
             catch (Exception ex2)
             {
-                // If that fails, then just return the original.
-                return location;
+                // Just fall through and return the original location.
             }
-            guess = baseURL + guess;
         }
-        return guess;
+        return location;
     }
-}
+}
\ No newline at end of file

Modified: 
felix/trunk/shell/src/main/java/org/apache/felix/shell/impl/UpdateCommandImpl.java
URL: 
http://svn.apache.org/viewvc/felix/trunk/shell/src/main/java/org/apache/felix/shell/impl/UpdateCommandImpl.java?rev=654601&r1=654600&r2=654601&view=diff
==============================================================================
--- 
felix/trunk/shell/src/main/java/org/apache/felix/shell/impl/UpdateCommandImpl.java
 (original)
+++ 
felix/trunk/shell/src/main/java/org/apache/felix/shell/impl/UpdateCommandImpl.java
 Thu May  8 12:35:03 2008
@@ -137,10 +137,6 @@
 
     private String absoluteLocation(String location)
     {
-        if (!location.endsWith(".jar"))
-        {
-            location = location + ".jar";
-        }
         try
         {
             new URL(location);
@@ -167,13 +163,12 @@
 
                 String theURL = baseURL + location;
                 new URL(theURL);
-
+                location = theURL;
             }
             catch (Exception ex2)
             {
-                return null;
+                // Just fall through and return the original location.
             }
-            location = baseURL + location;
         }
         return location;
     }


Reply via email to