From 09c00c6a1995c0910adec57e0b1bd2177348d811 Mon Sep 17 00:00:00 2001 From: Adi Eyal Date: Fri, 5 May 2017 23:38:37 +0200 Subject: [PATCH] Fixes #1181 --- .../refine/importers/ImportingParserBase.java | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/main/src/com/google/refine/importers/ImportingParserBase.java b/main/src/com/google/refine/importers/ImportingParserBase.java index 400df3fdc..b36c452d2 100644 --- a/main/src/com/google/refine/importers/ImportingParserBase.java +++ b/main/src/com/google/refine/importers/ImportingParserBase.java @@ -164,16 +164,20 @@ abstract public class ImportingParserBase implements ImportingParser { protected static int addFilenameColumn(Project project) { String fileNameColumnName = "File"; - assert project.columnModel.getColumnByName(fileNameColumnName) == null; - try { - project.columnModel.addColumn( - 0, new Column(project.columnModel.allocateNewCellIndex(), fileNameColumnName), false); + if (project.columnModel.getColumnByName(fileNameColumnName) == null) { + try { + project.columnModel.addColumn( + 0, new Column(project.columnModel.allocateNewCellIndex(), fileNameColumnName), false); + + return 0; + } catch (ModelException e) { + // Shouldn't happen: We already checked for duplicate name. + logger.error("ModelException adding Filename column",e); + } + return -1; + } else { return 0; - } catch (ModelException e) { - // Shouldn't happen: We already checked for duplicate name. - logger.error("ModelException adding Filename column",e); } - return -1; } }