File tree Expand file tree Collapse file tree
src/java/org/apache/commons/csv Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2424 */
2525public class CSVUtils {
2626
27+ private static final String [] EMPTY_STRING_ARRAY = new String [0 ];
28+ private static final String [][] EMPTY_DOUBLE_STRING_ARRAY = new String [0 ][0 ];
29+
2730 /**
2831 * <p><code>CSVUtils</code> instances should NOT be constructed in
2932 * standard programming.
@@ -86,7 +89,7 @@ public static String[][] parse(String s) throws IOException {
8689 if (result == null ) {
8790 // since CSVStrategy ignores empty lines an empty array is returned
8891 // (i.e. not "result = new String[][] {{""}};")
89- result = new String [ 0 ][ 0 ] ;
92+ result = EMPTY_DOUBLE_STRING_ARRAY ;
9093 }
9194 return result ;
9295 }
@@ -108,7 +111,7 @@ public static String[] parseLine(String s) throws IOException {
108111 }
109112 // uh,jh: make sure that parseLine("").length == 0
110113 if (s .length () == 0 ) {
111- return new String [ 0 ] ;
114+ return EMPTY_STRING_ARRAY ;
112115 }
113116 return (new CSVParser (new StringReader (s ))).getLine ();
114117 }
You can’t perform that action at this time.
0 commit comments