Clean up a couple more format guessing issues left over from #685

This commit is contained in:
Tom Morris 2013-03-06 20:39:39 -05:00
parent ca09ae6f90
commit d8d82bf8b7
2 changed files with 4 additions and 2 deletions

View File

@ -13,7 +13,7 @@ public class LineBasedFormatGuesser implements FormatGuesser {
return "text/line-based/*sv"; return "text/line-based/*sv";
} }
int[] widths = FixedWidthImporter.guessColumnWidths(file, encoding); int[] widths = FixedWidthImporter.guessColumnWidths(file, encoding);
if (widths != null) { if (widths != null && widths.length > 0) {
return "text/line-based/fixed-width"; return "text/line-based/fixed-width";
} }
return null; return null;

View File

@ -270,7 +270,9 @@ public class ImportingManager {
static public String getFormat(String fileName, String mimeType) { static public String getFormat(String fileName, String mimeType) {
String fileNameFormat = getFormatFromFileName(fileName); String fileNameFormat = getFormatFromFileName(fileName);
mimeType = mimeType.split(";")[0]; if (mimeType != null) {
mimeType = mimeType.split(";")[0];
}
String mimeTypeFormat = mimeType == null ? null : getFormatFromMimeType(mimeType); String mimeTypeFormat = mimeType == null ? null : getFormatFromMimeType(mimeType);
if (mimeTypeFormat == null) { if (mimeTypeFormat == null) {
return fileNameFormat; return fileNameFormat;