diff --git a/src/main/java/org/scijava/convert/FileListConverters.java b/src/main/java/org/scijava/convert/FileListConverters.java index ed3da126e..47a81053c 100644 --- a/src/main/java/org/scijava/convert/FileListConverters.java +++ b/src/main/java/org/scijava/convert/FileListConverters.java @@ -82,6 +82,8 @@ public T convert(final Object src, final Class dest) { final String[] tokens = StringUtils.splitUnquoted((String) src, ","); final List fileList = new ArrayList<>(); for (final String filePath : tokens) { + if ( filePath.isEmpty() ) + continue; fileList.add(new File(filePath.replaceAll("^\"|\"$", ""))); } return (T) fileList.toArray(new File[fileList.size()]); diff --git a/src/test/java/org/scijava/convert/FileListConverterTest.java b/src/test/java/org/scijava/convert/FileListConverterTest.java index 0276fe63a..71afaa2dc 100644 --- a/src/test/java/org/scijava/convert/FileListConverterTest.java +++ b/src/test/java/org/scijava/convert/FileListConverterTest.java @@ -69,6 +69,7 @@ public void testStringToFileArrayConverter() { conv.convert(path, File[].class)[0]); assertEquals("Wrong file name", new File("C:\\temp"), conv.convert(path, File[].class)[1]); + assertEquals( 0, conv.convert( "", File[].class ).length ); } @Test