Modified "update" command to not append ".jar" to URLs and also modified the
"install" command to use the same code. (FELIX-544)


git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@654601 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/shell/src/main/java/org/apache/felix/shell/impl/InstallCommandImpl.java b/shell/src/main/java/org/apache/felix/shell/impl/InstallCommandImpl.java
index 1ceb53f..f52c536 100644
--- a/shell/src/main/java/org/apache/felix/shell/impl/InstallCommandImpl.java
+++ b/shell/src/main/java/org/apache/felix/shell/impl/InstallCommandImpl.java
@@ -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
diff --git a/shell/src/main/java/org/apache/felix/shell/impl/UpdateCommandImpl.java b/shell/src/main/java/org/apache/felix/shell/impl/UpdateCommandImpl.java
index 88b3a0e..7f8ed01 100644
--- a/shell/src/main/java/org/apache/felix/shell/impl/UpdateCommandImpl.java
+++ b/shell/src/main/java/org/apache/felix/shell/impl/UpdateCommandImpl.java
@@ -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;
     }