Don't die if we get passed no candidates
git-svn-id: http://google-refine.googlecode.com/svn/trunk@2210 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
parent
9025a64dd0
commit
9d7b8a5279
@ -79,6 +79,7 @@ public class ExcelImporter extends TabularImportingParserBase {
|
||||
JSONArray sheetRecords = new JSONArray();
|
||||
JSONUtilities.safePut(options, "sheetRecords", sheetRecords);
|
||||
try {
|
||||
if (fileRecords.size() > 0) {
|
||||
JSONObject firstFileRecord = fileRecords.get(0);
|
||||
File file = ImportingUtilities.getFile(job, firstFileRecord);
|
||||
InputStream is = new FileInputStream(file);
|
||||
@ -107,6 +108,7 @@ public class ExcelImporter extends TabularImportingParserBase {
|
||||
} finally {
|
||||
is.close();
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
// Ignore
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ public class FixedWidthImporter extends TabularImportingParserBase {
|
||||
ImportingJob job, List<JSONObject> fileRecords, String format) {
|
||||
JSONObject options = super.createParserUIInitializationData(job, fileRecords, format);
|
||||
JSONArray columnWidths = new JSONArray();
|
||||
|
||||
if (fileRecords.size() > 0) {
|
||||
JSONObject firstFileRecord = fileRecords.get(0);
|
||||
String encoding = ImportingUtilities.getEncoding(firstFileRecord);
|
||||
String location = JSONUtilities.getString(firstFileRecord, "location", null);
|
||||
@ -48,7 +48,7 @@ public class FixedWidthImporter extends TabularImportingParserBase {
|
||||
JSONUtilities.safePut(options, "headerLines", 0);
|
||||
JSONUtilities.safePut(options, "columnWidths", columnWidths);
|
||||
JSONUtilities.safePut(options, "guessCellValueTypes", true);
|
||||
|
||||
}
|
||||
return options;
|
||||
}
|
||||
|
||||
|
@ -75,6 +75,7 @@ public class JsonImporter extends TreeImportingParserBase {
|
||||
public JSONObject createParserUIInitializationData(
|
||||
ImportingJob job, List<JSONObject> fileRecords, String format) {
|
||||
JSONObject options = super.createParserUIInitializationData(job, fileRecords, format);
|
||||
if (fileRecords.size() > 0) {
|
||||
try {
|
||||
JSONObject firstFileRecord = fileRecords.get(0);
|
||||
File file = ImportingUtilities.getFile(job, firstFileRecord);
|
||||
@ -94,6 +95,7 @@ public class JsonImporter extends TreeImportingParserBase {
|
||||
} catch (IOException e) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
@ -73,6 +73,7 @@ public class XmlImporter extends TreeImportingParserBase {
|
||||
ImportingJob job, List<JSONObject> fileRecords, String format) {
|
||||
JSONObject options = super.createParserUIInitializationData(job, fileRecords, format);
|
||||
try {
|
||||
if (fileRecords.size() > 0) {
|
||||
JSONObject firstFileRecord = fileRecords.get(0);
|
||||
File file = ImportingUtilities.getFile(job, firstFileRecord);
|
||||
InputStream is = new FileInputStream(file);
|
||||
@ -96,6 +97,7 @@ public class XmlImporter extends TreeImportingParserBase {
|
||||
} finally {
|
||||
is.close();
|
||||
}
|
||||
}
|
||||
} catch (XMLStreamException e) {
|
||||
// Ignore
|
||||
} catch (IOException e) {
|
||||
|
Loading…
Reference in New Issue
Block a user