karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r1102131 - in /karaf/trunk/features/core/src/main/java/org/apache/karaf/features/internal: FeatureValidationUtil.java FeaturesServiceImpl.java
Date Wed, 11 May 2011 23:09:23 GMT
Author: djencks
Date: Wed May 11 23:09:23 2011
New Revision: 1102131

URL: http://svn.apache.org/viewvc?rev=1102131&view=rev
Log:
provide better error messages in a couple cases

Modified:
    karaf/trunk/features/core/src/main/java/org/apache/karaf/features/internal/FeatureValidationUtil.java
    karaf/trunk/features/core/src/main/java/org/apache/karaf/features/internal/FeaturesServiceImpl.java

Modified: karaf/trunk/features/core/src/main/java/org/apache/karaf/features/internal/FeatureValidationUtil.java
URL: http://svn.apache.org/viewvc/karaf/trunk/features/core/src/main/java/org/apache/karaf/features/internal/FeatureValidationUtil.java?rev=1102131&r1=1102130&r2=1102131&view=diff
==============================================================================
--- karaf/trunk/features/core/src/main/java/org/apache/karaf/features/internal/FeatureValidationUtil.java
(original)
+++ karaf/trunk/features/core/src/main/java/org/apache/karaf/features/internal/FeatureValidationUtil.java
Wed May 11 23:09:23 2011
@@ -15,6 +15,7 @@
  */
 package org.apache.karaf.features.internal;
 
+import java.io.IOException;
 import java.io.InputStream;
 import java.net.URI;
 import java.net.URLConnection;
@@ -43,7 +44,12 @@ public class FeatureValidationUtil {
      * @throws Exception When validation fails.
      */
     public static void validate(URI uri) throws Exception {
-        URLConnection conn = uri.toURL().openConnection();
+        URLConnection conn = null;
+        try {
+            conn = uri.toURL().openConnection();
+        } catch (IllegalArgumentException e) {
+            throw new IllegalArgumentException("invalid URI: " + uri, e);
+        }
         conn.setDefaultUseCaches(false);
 
         InputStream stream = conn.getInputStream();

Modified: karaf/trunk/features/core/src/main/java/org/apache/karaf/features/internal/FeaturesServiceImpl.java
URL: http://svn.apache.org/viewvc/karaf/trunk/features/core/src/main/java/org/apache/karaf/features/internal/FeaturesServiceImpl.java?rev=1102131&r1=1102130&r2=1102131&view=diff
==============================================================================
--- karaf/trunk/features/core/src/main/java/org/apache/karaf/features/internal/FeaturesServiceImpl.java
(original)
+++ karaf/trunk/features/core/src/main/java/org/apache/karaf/features/internal/FeaturesServiceImpl.java
Wed May 11 23:09:23 2011
@@ -185,7 +185,10 @@ public class FeaturesServiceImpl impleme
         String[] s = uris.split(",");
         this.uris = new HashSet<URI>();
         for (String value : s) {
-            this.uris.add(new URI(value));
+            value = value.trim();
+            if (!value.isEmpty()) {
+                this.uris.add(new URI(value));
+            }
         }
     }
 
@@ -656,6 +659,9 @@ public class FeaturesServiceImpl impleme
                 throw new BundleException("Manifest not present in the first entry of the
zip " + bundleLocation);
             }
             String sn = m.getMainAttributes().getValue(Constants.BUNDLE_SYMBOLICNAME);
+            if (sn == null) {
+                throw new BundleException("Jar is not a bundle, no Bundle-SymbolicName "
+ bundleLocation);
+            }
             // remove attributes from the symbolic name (like ;blueprint.graceperiod:=false
suffix)
             int attributeIndexSep = sn.indexOf(';');
             if (attributeIndexSep != -1) {



Mime
View raw message