Author: nextgens
Date: 2007-07-09 22:05:46 +0000 (Mon, 09 Jul 2007)
New Revision: 14008

Modified:
   trunk/freenet/src/freenet/support/SimpleFieldSet.java
Log:
SimpleFieldSet.namesOfDirectSubsets() should return a String[0] insteed of null 
if the SFS is empty

Modified: trunk/freenet/src/freenet/support/SimpleFieldSet.java
===================================================================
--- trunk/freenet/src/freenet/support/SimpleFieldSet.java       2007-07-09 
21:55:47 UTC (rev 14007)
+++ trunk/freenet/src/freenet/support/SimpleFieldSet.java       2007-07-09 
22:05:46 UTC (rev 14008)
@@ -35,6 +35,7 @@
     static public final char MULTI_LEVEL_CHAR = '.';
     static public final char MULTI_VALUE_CHAR = ';';
     static public final char KEYVALUE_SEPARATOR_CHAR = '=';
+    private static final String[] EMPTY_STRING_ARRAY = new String[0];

     /**
      * Create a SimpleFieldSet.
@@ -644,7 +645,7 @@
        }

        public String[] namesOfDirectSubsets() {
-               return (subsets == null) ? null : (String[]) 
subsets.keySet().toArray(new String[subsets.size()]);
+               return (subsets == null) ? EMPTY_STRING_ARRAY : (String[]) 
subsets.keySet().toArray(new String[subsets.size()]);
        }

        public static SimpleFieldSet readFrom(InputStream is, boolean 
allowMultiple, boolean shortLived) throws IOException {


Reply via email to