From 0cb33413241ec2bc3a17c7102f4f02a398f10ccb Mon Sep 17 00:00:00 2001 From: giwa Date: Fri, 3 Feb 2023 12:07:36 +0900 Subject: [PATCH 1/3] update embulk --- build.gradle | 9 ++++++--- .../embulk/parser/poi_excel/PoiExcelParserPlugin.java | 3 +-- .../parser/poi_excel/visitor/PoiExcelColumnVisitor.java | 7 ++++++- src/test/java/org/embulk/parser/EmbulkPluginTester.java | 4 +--- .../java/org/embulk/parser/EmbulkTestOutputPlugin.java | 9 +++++++++ 5 files changed, 23 insertions(+), 9 deletions(-) diff --git a/build.gradle b/build.gradle index 5ceef2d..7ff400d 100755 --- a/build.gradle +++ b/build.gradle @@ -19,15 +19,18 @@ sourceCompatibility = 1.7 targetCompatibility = 1.7 dependencies { - compile "org.embulk:embulk-core:0.7.5" - provided "org.embulk:embulk-core:0.7.5" - compile "org.embulk:embulk-standards:0.7.5" + compile "org.embulk:embulk-core:0.9.23" + provided "org.embulk:embulk-core:0.9.23" + compile "org.embulk:embulk-standards:0.9.23" + compile 'org.embulk:embulk-deps-buffer:0.9.23' // compile "YOUR_JAR_DEPENDENCY_GROUP:YOUR_JAR_DEPENDENCY_MODULE:YOUR_JAR_DEPENDENCY_VERSION" compile group: 'org.apache.poi', name : 'poi', version: '3.17' compile(group: 'org.apache.poi', name : 'poi-ooxml', version: '3.17') { exclude group: 'stax', module: 'stax-api' } testCompile "junit:junit:4.+" + testCompile 'org.embulk:embulk-test:0.9.23' + testCompile "org.embulk:embulk-core:0.9.23:tests" } task classpath(type: Copy, dependsOn: ["jar"]) { diff --git a/src/main/java/org/embulk/parser/poi_excel/PoiExcelParserPlugin.java b/src/main/java/org/embulk/parser/poi_excel/PoiExcelParserPlugin.java index f580d88..a5310ab 100755 --- a/src/main/java/org/embulk/parser/poi_excel/PoiExcelParserPlugin.java +++ b/src/main/java/org/embulk/parser/poi_excel/PoiExcelParserPlugin.java @@ -36,7 +36,6 @@ import org.slf4j.Logger; import com.google.common.base.Optional; -import com.ibm.icu.text.MessageFormat; public class PoiExcelParserPlugin implements ParserPlugin { private final Logger log = Exec.getLogger(getClass()); @@ -268,7 +267,7 @@ protected void run(PluginTask task, Schema schema, Workbook workbook, List Date: Fri, 3 Feb 2023 14:14:56 +0900 Subject: [PATCH 2/3] update poi excel --- build.gradle | 6 ++--- .../poi_excel/PoiExcelParserPlugin.java | 2 +- .../visitor/PoiExcelCellFontVisitor.java | 2 +- .../visitor/PoiExcelCellStyleVisitor.java | 22 +++++++++---------- .../visitor/PoiExcelCellValueVisitor.java | 10 ++++----- .../visitor/PoiExcelColumnVisitor.java | 8 +++---- 6 files changed, 25 insertions(+), 25 deletions(-) diff --git a/build.gradle b/build.gradle index 7ff400d..24de407 100755 --- a/build.gradle +++ b/build.gradle @@ -13,7 +13,7 @@ configurations { provided } -version = "0.1.12" +version = "0.1.12.1" sourceCompatibility = 1.7 targetCompatibility = 1.7 @@ -24,8 +24,8 @@ dependencies { compile "org.embulk:embulk-standards:0.9.23" compile 'org.embulk:embulk-deps-buffer:0.9.23' // compile "YOUR_JAR_DEPENDENCY_GROUP:YOUR_JAR_DEPENDENCY_MODULE:YOUR_JAR_DEPENDENCY_VERSION" - compile group: 'org.apache.poi', name : 'poi', version: '3.17' - compile(group: 'org.apache.poi', name : 'poi-ooxml', version: '3.17') { + compile group: 'org.apache.poi', name : 'poi', version: '5.2.3' + compile(group: 'org.apache.poi', name : 'poi-ooxml', version: '5.2.3') { exclude group: 'stax', module: 'stax-api' } testCompile "junit:junit:4.+" diff --git a/src/main/java/org/embulk/parser/poi_excel/PoiExcelParserPlugin.java b/src/main/java/org/embulk/parser/poi_excel/PoiExcelParserPlugin.java index a5310ab..d231dee 100755 --- a/src/main/java/org/embulk/parser/poi_excel/PoiExcelParserPlugin.java +++ b/src/main/java/org/embulk/parser/poi_excel/PoiExcelParserPlugin.java @@ -196,7 +196,7 @@ public void run(TaskSource taskSource, Schema schema, FileInput input, PageOutpu Workbook workbook; try { workbook = WorkbookFactory.create(is); - } catch (IOException | EncryptedDocumentException | InvalidFormatException e) { + } catch (IOException | EncryptedDocumentException e) { throw new RuntimeException(e); } diff --git a/src/main/java/org/embulk/parser/poi_excel/visitor/PoiExcelCellFontVisitor.java b/src/main/java/org/embulk/parser/poi_excel/visitor/PoiExcelCellFontVisitor.java index 74e3847..f3ae954 100755 --- a/src/main/java/org/embulk/parser/poi_excel/visitor/PoiExcelCellFontVisitor.java +++ b/src/main/java/org/embulk/parser/poi_excel/visitor/PoiExcelCellFontVisitor.java @@ -21,7 +21,7 @@ public PoiExcelCellFontVisitor(PoiExcelVisitorValue visitorValue) { @Override protected Font getAttributeSource(PoiExcelColumnBean bean, Cell cell) { CellStyle style = cell.getCellStyle(); - short index = style.getFontIndex(); + int index = style.getFontIndex(); Workbook book = visitorValue.getSheet().getWorkbook(); return book.getFontAt(index); } diff --git a/src/main/java/org/embulk/parser/poi_excel/visitor/PoiExcelCellStyleVisitor.java b/src/main/java/org/embulk/parser/poi_excel/visitor/PoiExcelCellStyleVisitor.java index e534b86..9a5ce9f 100755 --- a/src/main/java/org/embulk/parser/poi_excel/visitor/PoiExcelCellStyleVisitor.java +++ b/src/main/java/org/embulk/parser/poi_excel/visitor/PoiExcelCellStyleVisitor.java @@ -41,16 +41,16 @@ protected Map> getAttributeSupplierMap() { map.put("alignment", new AttributeSupplier() { @Override public Object get(Column column, Cell cell, CellStyle style) { - return (long) style.getAlignmentEnum().getCode(); + return (long) style.getAlignment().getCode(); } }); map.put("border", new AttributeSupplier() { @Override public Object get(Column column, Cell cell, CellStyle style) { - int n0 = style.getBorderTopEnum().getCode(); - int n1 = style.getBorderBottomEnum().getCode(); - int n2 = style.getBorderLeftEnum().getCode(); - int n3 = style.getBorderRightEnum().getCode(); + int n0 = style.getBorderTop().getCode(); + int n1 = style.getBorderBottom().getCode(); + int n2 = style.getBorderLeft().getCode(); + int n3 = style.getBorderRight().getCode(); if (column.getType() instanceof StringType) { return String.format("%02x%02x%02x%02x", n0, n1, n2, n3); } @@ -60,25 +60,25 @@ public Object get(Column column, Cell cell, CellStyle style) { map.put("border_bottom", new AttributeSupplier() { @Override public Object get(Column column, Cell cell, CellStyle style) { - return (long) style.getBorderBottomEnum().getCode(); + return (long) style.getBorderBottom().getCode(); } }); map.put("border_left", new AttributeSupplier() { @Override public Object get(Column column, Cell cell, CellStyle style) { - return (long) style.getBorderLeftEnum().getCode(); + return (long) style.getBorderLeft().getCode(); } }); map.put("border_right", new AttributeSupplier() { @Override public Object get(Column column, Cell cell, CellStyle style) { - return (long) style.getBorderRightEnum().getCode(); + return (long) style.getBorderRight().getCode(); } }); map.put("border_top", new AttributeSupplier() { @Override public Object get(Column column, Cell cell, CellStyle style) { - return (long) style.getBorderTopEnum().getCode(); + return (long) style.getBorderTop().getCode(); } }); map.put("border_bottom_color", new AttributeSupplier() { @@ -154,7 +154,7 @@ public Object get(Column column, Cell cell, CellStyle style) { map.put("fill_pattern", new AttributeSupplier() { @Override public Object get(Column column, Cell cell, CellStyle style) { - return (long) style.getFillPatternEnum().getCode(); + return (long) style.getFillPattern().getCode(); } }); map.put("font_index", new AttributeSupplier() { @@ -190,7 +190,7 @@ public Object get(Column column, Cell cell, CellStyle style) { map.put("vertical_alignment", new AttributeSupplier() { @Override public Object get(Column column, Cell cell, CellStyle style) { - return (long) style.getVerticalAlignmentEnum().getCode(); + return (long) style.getVerticalAlignment().getCode(); } }); map.put("wrap_text", new AttributeSupplier() { diff --git a/src/main/java/org/embulk/parser/poi_excel/visitor/PoiExcelCellValueVisitor.java b/src/main/java/org/embulk/parser/poi_excel/visitor/PoiExcelCellValueVisitor.java index fa9fe78..6369a98 100755 --- a/src/main/java/org/embulk/parser/poi_excel/visitor/PoiExcelCellValueVisitor.java +++ b/src/main/java/org/embulk/parser/poi_excel/visitor/PoiExcelCellValueVisitor.java @@ -42,7 +42,7 @@ public void visitCellValue(PoiExcelColumnBean bean, Cell cell, CellVisitor visit Column column = bean.getColumn(); - CellType cellType = cell.getCellTypeEnum(); + CellType cellType = cell.getCellType(); switch (cellType) { case NUMERIC: visitor.visitCellValueNumeric(column, cell, cell.getNumericCellValue()); @@ -73,7 +73,7 @@ public void visitCellValue(PoiExcelColumnBean bean, Cell cell, CellVisitor visit } protected void visitCellValueBlank(PoiExcelColumnBean bean, Cell cell, CellVisitor visitor) { - assert cell.getCellTypeEnum() == CellType.BLANK; + assert cell.getCellType() == CellType.BLANK; Column column = bean.getColumn(); @@ -109,7 +109,7 @@ protected CellRangeAddress findRegion(PoiExcelColumnBean bean, Cell cell) { } protected void visitCellValueFormula(PoiExcelColumnBean bean, Cell cell, CellVisitor visitor) { - assert cell.getCellTypeEnum() == CellType.FORMULA; + assert cell.getCellType() == CellType.FORMULA; FormulaHandling handling = bean.getFormulaHandling(); switch (handling) { @@ -125,7 +125,7 @@ protected void visitCellValueFormula(PoiExcelColumnBean bean, Cell cell, CellVis protected void visitCellValueFormulaCashedValue(PoiExcelColumnBean bean, Cell cell, CellVisitor visitor) { Column column = bean.getColumn(); - CellType cellType = cell.getCachedFormulaResultTypeEnum(); + CellType cellType = cell.getCachedFormulaResultType(); switch (cellType) { case NUMERIC: visitor.visitCellValueNumeric(column, cell, cell.getNumericCellValue()); @@ -205,7 +205,7 @@ protected void visitCellValueFormulaEvaluate(PoiExcelColumnBean bean, Cell cell, throw new RuntimeException(MessageFormat.format("evaluate error. formula={0}", cell.getCellFormula()), e); } - CellType cellType = cellValue.getCellTypeEnum(); + CellType cellType = cellValue.getCellType(); switch (cellType) { case NUMERIC: visitor.visitCellValueNumeric(column, cellValue, cellValue.getNumberValue()); diff --git a/src/main/java/org/embulk/parser/poi_excel/visitor/PoiExcelColumnVisitor.java b/src/main/java/org/embulk/parser/poi_excel/visitor/PoiExcelColumnVisitor.java index d49be65..4019033 100755 --- a/src/main/java/org/embulk/parser/poi_excel/visitor/PoiExcelColumnVisitor.java +++ b/src/main/java/org/embulk/parser/poi_excel/visitor/PoiExcelColumnVisitor.java @@ -147,13 +147,13 @@ protected void visitCell(Column column, CellVisitor visitor) { visitCellComment(bean, cell, visitor); return; case CELL_TYPE: - visitCellType(bean, cell, cell.getCellTypeEnum(), visitor); + visitCellType(bean, cell, cell.getCellType(), visitor); return; case CELL_CACHED_TYPE: - if (cell.getCellTypeEnum() == CellType.FORMULA) { - visitCellType(bean, cell, cell.getCachedFormulaResultTypeEnum(), visitor); + if (cell.getCellType() == CellType.FORMULA) { + visitCellType(bean, cell, cell.getCachedFormulaResultType(), visitor); } else { - visitCellType(bean, cell, cell.getCellTypeEnum(), visitor); + visitCellType(bean, cell, cell.getCellType(), visitor); } return; default: From e9795dcbc21246b08f48080486eb397b3bba7f65 Mon Sep 17 00:00:00 2001 From: giwa Date: Fri, 3 Feb 2023 14:15:27 +0900 Subject: [PATCH 3/3] fix version --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 24de407..d00f469 100755 --- a/build.gradle +++ b/build.gradle @@ -13,7 +13,7 @@ configurations { provided } -version = "0.1.12.1" +version = "0.1.12" sourceCompatibility = 1.7 targetCompatibility = 1.7