From ad4e59887f00586c766979d5071a4bf42d8f6790 Mon Sep 17 00:00:00 2001 From: Ralph Soika Date: Mon, 25 Nov 2024 11:18:47 +0100 Subject: [PATCH] fixed null pointer exception and shift 0 Issue #165 --- .../src/main/java/org/imixs/workflow/poi/POIUtil.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/imixs-adapters-poi/src/main/java/org/imixs/workflow/poi/POIUtil.java b/imixs-adapters-poi/src/main/java/org/imixs/workflow/poi/POIUtil.java index 5c46ec5..400c04d 100644 --- a/imixs-adapters-poi/src/main/java/org/imixs/workflow/poi/POIUtil.java +++ b/imixs-adapters-poi/src/main/java/org/imixs/workflow/poi/POIUtil.java @@ -31,6 +31,10 @@ public class POIUtil { */ public static void insertRows(XSSFSheet sheet, String cellReference, int numberOfRows) { + if (sheet == null || numberOfRows == 0 || cellReference == null || cellReference.isEmpty()) { + // no op + return; + } CellReference refCell = new CellReference(cellReference); XSSFRow refRow = sheet.getRow(refCell.getRow()); @@ -61,6 +65,11 @@ public static void insertRows(XSSFSheet sheet, String cellReference, int numberO */ public static void insertColumn(XSSFSheet sheet, int startColumn, int endColumn) { + if (sheet == null || endColumn == 0) { + // no op + return; + } + logger.fine("start Column=" + startColumn); // // Find the last column by checking all rows