You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by gn...@apache.org on 2010/09/21 13:43:05 UTC

svn commit: r999338 - /karaf/branches/karaf-2.0.x/shell/config/src/main/java/org/apache/karaf/shell/config/Properties.java

Author: gnodet
Date: Tue Sep 21 11:43:05 2010
New Revision: 999338

URL: http://svn.apache.org/viewvc?rev=999338&view=rev
Log:
KARAF-167: Creating a new config using the shell commands lead to a FileNotFoundException instead of the file being created. Patch provided by Ioannis Cannellos

Modified:
    karaf/branches/karaf-2.0.x/shell/config/src/main/java/org/apache/karaf/shell/config/Properties.java

Modified: karaf/branches/karaf-2.0.x/shell/config/src/main/java/org/apache/karaf/shell/config/Properties.java
URL: http://svn.apache.org/viewvc/karaf/branches/karaf-2.0.x/shell/config/src/main/java/org/apache/karaf/shell/config/Properties.java?rev=999338&r1=999337&r2=999338&view=diff
==============================================================================
--- karaf/branches/karaf-2.0.x/shell/config/src/main/java/org/apache/karaf/shell/config/Properties.java (original)
+++ karaf/branches/karaf-2.0.x/shell/config/src/main/java/org/apache/karaf/shell/config/Properties.java Tue Sep 21 11:43:05 2010
@@ -57,7 +57,8 @@ public class Properties extends Abstract
 
     public Properties(File location) throws IOException {
         this.location = location;
-        load(location);
+        if(location.exists())
+            load(location);
     }
 
     public void load(File location) throws IOException {
@@ -226,14 +227,14 @@ public class Properties extends Abstract
         for (String key : storage.keySet())
         {
             Layout l = layout.get(key);
-            if (l.getCommentLines() != null)
+            if (l != null && l.getCommentLines() != null)
             {
                 for (String s : l.getCommentLines())
                 {
                     writer.writeln(s);
                 }
             }
-            if (l.getValueLines() != null)
+            if (l != null && l.getValueLines() != null)
             {
                 for (String s : l.getValueLines())
                 {