incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdelacre...@apache.org
Subject svn commit: r1600874 - /sling/trunk/contrib/crankstart/core/src/main/java/org/apache/sling/crankstart/core/commands/Configure.java
Date Fri, 06 Jun 2014 12:44:06 GMT
Author: bdelacretaz
Date: Fri Jun  6 12:44:06 2014
New Revision: 1600874

URL: http://svn.apache.org/r1600874
Log:
Better parsing error report

Modified:
    sling/trunk/contrib/crankstart/core/src/main/java/org/apache/sling/crankstart/core/commands/Configure.java

Modified: sling/trunk/contrib/crankstart/core/src/main/java/org/apache/sling/crankstart/core/commands/Configure.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/crankstart/core/src/main/java/org/apache/sling/crankstart/core/commands/Configure.java?rev=1600874&r1=1600873&r2=1600874&view=diff
==============================================================================
--- sling/trunk/contrib/crankstart/core/src/main/java/org/apache/sling/crankstart/core/commands/Configure.java
(original)
+++ sling/trunk/contrib/crankstart/core/src/main/java/org/apache/sling/crankstart/core/commands/Configure.java
Fri Jun  6 12:44:06 2014
@@ -27,6 +27,7 @@ import org.apache.felix.cm.file.Configur
 import org.apache.sling.crankstart.api.CrankstartCommand;
 import org.apache.sling.crankstart.api.CrankstartCommandLine;
 import org.apache.sling.crankstart.api.CrankstartContext;
+import org.apache.sling.crankstart.api.CrankstartException;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
 import org.slf4j.Logger;
@@ -96,7 +97,7 @@ public class Configure implements Cranks
     }
     
     @SuppressWarnings("unchecked")
-    private Dictionary<String, Object> parseFelixConfig(Dictionary<String, Object>
properties) throws IOException {
+    private Dictionary<String, Object> parseFelixConfig(Dictionary<String, Object>
properties) {
         // Build a stream in Felix .config format and parse it
         if(properties == null) {
             return new Hashtable<String, Object>();
@@ -110,11 +111,15 @@ public class Configure implements Cranks
             sb.append(key).append("=").append(value).append("\n");
         }
         
-        final InputStream is = new ByteArrayInputStream(sb.toString().getBytes("UTF-8"));

         try {
-            return ConfigurationHandler.read(is);
-        } finally {
-            is.close();
+            final InputStream is = new ByteArrayInputStream(sb.toString().getBytes("UTF-8"));
+            try {
+                return ConfigurationHandler.read(is);
+            } finally {
+                is.close();
+            }
+        } catch(IOException ioe) {
+            throw new CrankstartException("Parsing error (Felix format config) for\n" + sb,
ioe);
         }
     }
 }



Mime
View raw message