Skip to content

Commit

Permalink
Prevent NullPointerException when header row does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
jlolling committed May 23, 2022
1 parent 7724b0a commit d23fa62
Show file tree
Hide file tree
Showing 15 changed files with 35 additions and 36 deletions.
Binary file added doc/tFileExcelReferencedCellOutput_example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>de.jlo.talendcomp</groupId>
<artifactId>jlo-talendcomp-excel</artifactId>
<version>13.4</version>
<version>13.5</version>
<name>Talend Excel Components</name>
<organization>
<name>Jan Lolling</name>
Expand Down
7 changes: 3 additions & 4 deletions src/main/java/de/jlo/talendcomp/excel/SpreadsheetInput.java
Original file line number Diff line number Diff line change
Expand Up @@ -769,6 +769,9 @@ public void setHeaderName(int columnIndex, String headerName, boolean ignoreMiss

public void configColumnPositions() throws Exception {
headerRow = sheet.getRow(headerRowIndex);
if (headerRow == null) {
throw new Exception("Try to configure column config for sheet: " + getTargetSheetName() + " by header row but there is no row at row-index: " + (headerRowIndex + 1)); // in the gui the index is 1-based
}
int lastCellNum = headerRow.getLastCellNum();
int firstCellNum = headerRow.getFirstCellNum();
for (int i = firstCellNum; i <= lastCellNum; i++) {
Expand Down Expand Up @@ -997,8 +1000,4 @@ public void setLenientDateParsing(Boolean lenientDateParsing) {
}
}

public Row getHeaderRow() {
return headerRow;
}

}
Binary file added talend_component/.DS_Store
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>

<COMPONENT>
<HEADER AUTHOR="Jan Lolling" COMPATIBILITY="ALL" DATA_AUTO_PROPAGATE="false" HAS_CONDITIONAL_OUTPUTS="false" PLATEFORM="ALL" RELEASE_DATE="20211217" SERIAL="" STARTABLE="true" STATUS="PROD" VERSION="13.4">
<HEADER AUTHOR="Jan Lolling" COMPATIBILITY="ALL" DATA_AUTO_PROPAGATE="false" HAS_CONDITIONAL_OUTPUTS="false" PLATEFORM="ALL" RELEASE_DATE="20220523" SERIAL="" STARTABLE="true" STATUS="PROD" VERSION="13.5">
<SIGNATURE/>
</HEADER>
<FAMILIES>
Expand Down Expand Up @@ -35,8 +35,8 @@
</PARAMETER>
</PARAMETERS>
<ADVANCED_PARAMETERS>
<PARAMETER NAME="RELEASE_LABEL_20211217" FIELD="LABEL" COLOR="0;0;0" NUM_ROW="900">
<DEFAULT>Release: 13.4 build at: 20211217</DEFAULT>
<PARAMETER NAME="RELEASE_LABEL_20220523" FIELD="LABEL" COLOR="0;0;0" NUM_ROW="900">
<DEFAULT>Release: 13.5 build at: 20220523</DEFAULT>
</PARAMETER>
</ADVANCED_PARAMETERS>
<CODEGENERATION>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>

<COMPONENT>
<HEADER AUTHOR="Jan Lolling" COMPATIBILITY="ALL" DATA_AUTO_PROPAGATE="false" HAS_CONDITIONAL_OUTPUTS="false" PLATEFORM="ALL" RELEASE_DATE="20211217" SERIAL="" STARTABLE="true" STATUS="ALPHA" VERSION="13.4">
<HEADER AUTHOR="Jan Lolling" COMPATIBILITY="ALL" DATA_AUTO_PROPAGATE="false" HAS_CONDITIONAL_OUTPUTS="false" PLATEFORM="ALL" RELEASE_DATE="20220523" SERIAL="" STARTABLE="true" STATUS="ALPHA" VERSION="13.5">
<SIGNATURE/>
</HEADER>
<FAMILIES>
Expand Down Expand Up @@ -42,8 +42,8 @@
<PARAMETER FIELD="CHECK" NAME="FORBID_WRITING_INTO_LOCKED_CELLS" NUM_ROW="40">
<DEFAULT>false</DEFAULT>
</PARAMETER>
<PARAMETER NAME="RELEASE_LABEL_20211217" FIELD="LABEL" COLOR="0;0;0" NUM_ROW="900">
<DEFAULT>Release: 13.4 build at: 20211217</DEFAULT>
<PARAMETER NAME="RELEASE_LABEL_20220523" FIELD="LABEL" COLOR="0;0;0" NUM_ROW="900">
<DEFAULT>Release: 13.5 build at: 20220523</DEFAULT>
</PARAMETER>
</ADVANCED_PARAMETERS>
<CODEGENERATION>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>

<COMPONENT>
<HEADER AUTHOR="Jan Lolling" COMPATIBILITY="ALL" DATA_AUTO_PROPAGATE="false" SCHEMA_AUTO_PROPAGATE="false" HAS_CONDITIONAL_OUTPUTS="false" PLATEFORM="ALL" RELEASE_DATE="20211217" SERIAL="" STARTABLE="false" STATUS="PROD" VERSION="13.4">
<HEADER AUTHOR="Jan Lolling" COMPATIBILITY="ALL" DATA_AUTO_PROPAGATE="false" SCHEMA_AUTO_PROPAGATE="false" HAS_CONDITIONAL_OUTPUTS="false" PLATEFORM="ALL" RELEASE_DATE="20220523" SERIAL="" STARTABLE="false" STATUS="PROD" VERSION="13.5">
<SIGNATURE/>
</HEADER>
<FAMILIES>
Expand Down Expand Up @@ -45,8 +45,8 @@
</PARAMETER>
</PARAMETERS>
<ADVANCED_PARAMETERS>
<PARAMETER NAME="RELEASE_LABEL_20211217" FIELD="LABEL" COLOR="0;0;0" NUM_ROW="900">
<DEFAULT>Release: 13.4 build at: 20211217</DEFAULT>
<PARAMETER NAME="RELEASE_LABEL_20220523" FIELD="LABEL" COLOR="0;0;0" NUM_ROW="900">
<DEFAULT>Release: 13.5 build at: 20220523</DEFAULT>
</PARAMETER>
</ADVANCED_PARAMETERS>
<CODEGENERATION>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>

<COMPONENT>
<HEADER AUTHOR="Jan Lolling" COMPATIBILITY="ALL" DATA_AUTO_PROPAGATE="false" SCHEMA_AUTO_PROPAGATE="false" HAS_CONDITIONAL_OUTPUTS="false" PLATEFORM="ALL" RELEASE_DATE="20211217" SERIAL="" STARTABLE="false" STATUS="PROD" VERSION="13.4">
<HEADER AUTHOR="Jan Lolling" COMPATIBILITY="ALL" DATA_AUTO_PROPAGATE="false" SCHEMA_AUTO_PROPAGATE="false" HAS_CONDITIONAL_OUTPUTS="false" PLATEFORM="ALL" RELEASE_DATE="20220523" SERIAL="" STARTABLE="false" STATUS="PROD" VERSION="13.5">
<SIGNATURE/>
</HEADER>
<FAMILIES>
Expand Down Expand Up @@ -40,8 +40,8 @@
<PARAMETER FIELD="CHECK" NAME="DO_NOT_SET_CELL_STYLE" NUM_ROW="40">
<DEFAULT>false</DEFAULT>
</PARAMETER>
<PARAMETER NAME="RELEASE_LABEL_20211217" FIELD="LABEL" COLOR="0;0;0" NUM_ROW="900">
<DEFAULT>Release: 13.4 build at: 20211217</DEFAULT>
<PARAMETER NAME="RELEASE_LABEL_20220523" FIELD="LABEL" COLOR="0;0;0" NUM_ROW="900">
<DEFAULT>Release: 13.5 build at: 20220523</DEFAULT>
</PARAMETER>
</ADVANCED_PARAMETERS>
<CODEGENERATION>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>

<COMPONENT>
<HEADER AUTHOR="Jan Lolling" COMPATIBILITY="ALL" DATA_AUTO_PROPAGATE="true" HAS_CONDITIONAL_OUTPUTS="false" PLATEFORM="ALL" RELEASE_DATE="20211217" SERIAL="" STARTABLE="true" STATUS="PROD" VERSION="13.4">
<HEADER AUTHOR="Jan Lolling" COMPATIBILITY="ALL" DATA_AUTO_PROPAGATE="true" HAS_CONDITIONAL_OUTPUTS="false" PLATEFORM="ALL" RELEASE_DATE="20220523" SERIAL="" STARTABLE="true" STATUS="PROD" VERSION="13.5">
<SIGNATURE/>
</HEADER>
<FAMILIES>
Expand Down Expand Up @@ -109,8 +109,8 @@
<ITEM NAME="TRIM" FIELD="CHECK"/>
</ITEMS>
</PARAMETER>
<PARAMETER NAME="RELEASE_LABEL_20211217" FIELD="LABEL" COLOR="0;0;0" NUM_ROW="900">
<DEFAULT>Release: 13.4 build at: 20211217</DEFAULT>
<PARAMETER NAME="RELEASE_LABEL_20220523" FIELD="LABEL" COLOR="0;0;0" NUM_ROW="900">
<DEFAULT>Release: 13.5 build at: 20220523</DEFAULT>
</PARAMETER>
</ADVANCED_PARAMETERS>
<CODEGENERATION>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>

<COMPONENT>
<HEADER AUTHOR="Jan Lolling" COMPATIBILITY="ALL" PLATEFORM="ALL" RELEASE_DATE="20211217" SERIAL="" STARTABLE="false" STATUS="PROD" VERSION="13.4" SCHEMA_AUTO_PROPAGATE="false" DATA_AUTO_PROPAGATE="false" HAS_CONDITIONAL_OUTPUTS="true" IS_MULTIPLYING_OUTPUTS="true">
<HEADER AUTHOR="Jan Lolling" COMPATIBILITY="ALL" PLATEFORM="ALL" RELEASE_DATE="20220523" SERIAL="" STARTABLE="false" STATUS="PROD" VERSION="13.5" SCHEMA_AUTO_PROPAGATE="false" DATA_AUTO_PROPAGATE="false" HAS_CONDITIONAL_OUTPUTS="true" IS_MULTIPLYING_OUTPUTS="true">
<SIGNATURE/>
</HEADER>
<FAMILIES>
Expand Down Expand Up @@ -41,8 +41,8 @@
<PARAMETER NAME="VALUE_COL_INDEX_COLUMN" FIELD="COLUMN_LIST" REQUIRED="true" NUM_ROW="80"/>
</PARAMETERS>
<ADVANCED_PARAMETERS>
<PARAMETER NAME="RELEASE_LABEL_20211217" FIELD="LABEL" COLOR="0;0;0" NUM_ROW="900">
<DEFAULT>Release: 13.4 build at: 20211217</DEFAULT>
<PARAMETER NAME="RELEASE_LABEL_20220523" FIELD="LABEL" COLOR="0;0;0" NUM_ROW="900">
<DEFAULT>Release: 13.5 build at: 20220523</DEFAULT>
</PARAMETER>
</ADVANCED_PARAMETERS>
<CODEGENERATION>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>

<COMPONENT>
<HEADER AUTHOR="cimt AG" COMPATIBILITY="ALL" DATA_AUTO_PROPAGATE="true" HAS_CONDITIONAL_OUTPUTS="false" PLATEFORM="ALL" RELEASE_DATE="20211217" SERIAL="" STARTABLE="true" STATUS="PROD" VERSION="13.4">
<HEADER AUTHOR="cimt AG" COMPATIBILITY="ALL" DATA_AUTO_PROPAGATE="true" HAS_CONDITIONAL_OUTPUTS="false" PLATEFORM="ALL" RELEASE_DATE="20220523" SERIAL="" STARTABLE="true" STATUS="PROD" VERSION="13.5">
<SIGNATURE/>
</HEADER>
<FAMILIES>
Expand Down Expand Up @@ -39,8 +39,8 @@
</PARAMETER>
</PARAMETERS>
<ADVANCED_PARAMETERS>
<PARAMETER NAME="RELEASE_LABEL_20211217" FIELD="LABEL" COLOR="0;0;0" NUM_ROW="900">
<DEFAULT>Release: 13.4 build at: 20211217</DEFAULT>
<PARAMETER NAME="RELEASE_LABEL_20220523" FIELD="LABEL" COLOR="0;0;0" NUM_ROW="900">
<DEFAULT>Release: 13.5 build at: 20220523</DEFAULT>
</PARAMETER>
</ADVANCED_PARAMETERS>
<CODEGENERATION>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>

<COMPONENT>
<HEADER AUTHOR="cimt AG" COMPATIBILITY="ALL" DATA_AUTO_PROPAGATE="true" HAS_CONDITIONAL_OUTPUTS="false" PLATEFORM="ALL" RELEASE_DATE="20211217" SERIAL="" STARTABLE="false" STATUS="PROD" VERSION="13.4">
<HEADER AUTHOR="cimt AG" COMPATIBILITY="ALL" DATA_AUTO_PROPAGATE="true" HAS_CONDITIONAL_OUTPUTS="false" PLATEFORM="ALL" RELEASE_DATE="20220523" SERIAL="" STARTABLE="false" STATUS="PROD" VERSION="13.5">
<SIGNATURE/>
</HEADER>
<FAMILIES>
Expand Down Expand Up @@ -111,8 +111,8 @@
<PARAMETER FIELD="CHECK" NAME="FORBID_WRITING_INTO_LOCKED_CELLS" NUM_ROW="40">
<DEFAULT>false</DEFAULT>
</PARAMETER>
<PARAMETER NAME="RELEASE_LABEL_20211217" FIELD="LABEL" COLOR="0;0;0" NUM_ROW="900">
<DEFAULT>Release: 13.4 build at: 20211217</DEFAULT>
<PARAMETER NAME="RELEASE_LABEL_20220523" FIELD="LABEL" COLOR="0;0;0" NUM_ROW="900">
<DEFAULT>Release: 13.5 build at: 20220523</DEFAULT>
</PARAMETER>
</ADVANCED_PARAMETERS>
<CODEGENERATION>
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>

<COMPONENT>
<HEADER AUTHOR="Jan Lolling" COMPATIBILITY="ALL" DATA_AUTO_PROPAGATE="false" PLATEFORM="ALL" RELEASE_DATE="20211217" SERIAL="" STARTABLE="true" STATUS="TEST" VERSION="13.4">
<HEADER AUTHOR="Jan Lolling" COMPATIBILITY="ALL" DATA_AUTO_PROPAGATE="false" PLATEFORM="ALL" RELEASE_DATE="20220523" SERIAL="" STARTABLE="true" STATUS="TEST" VERSION="13.5">
<SIGNATURE/>
</HEADER>
<FAMILIES>
Expand Down Expand Up @@ -68,13 +68,13 @@
<PARAMETER FIELD="TEXT" NAME="ZIP_BOMB_WARNING_THRESHOLD" NUM_ROW="20">
<DEFAULT>0.005d</DEFAULT>
</PARAMETER>
<PARAMETER NAME="RELEASE_LABEL_20211217" FIELD="LABEL" COLOR="0;0;0" NUM_ROW="900">
<DEFAULT>Release: 13.4 build at: 20211217</DEFAULT>
<PARAMETER NAME="RELEASE_LABEL_20220523" FIELD="LABEL" COLOR="0;0;0" NUM_ROW="900">
<DEFAULT>Release: 13.5 build at: 20220523</DEFAULT>
</PARAMETER>
</ADVANCED_PARAMETERS>
<CODEGENERATION>
<IMPORTS>
<IMPORT NAME="jlo-talendcomp-excel" MODULE="jlo-talendcomp-excel-13.4.jar" MVN="mvn:org.talend.libraries/jlo-talendcomp-excel-13.4/6.0.0-SNAPSHOT" REQUIRED="true"/>
<IMPORT NAME="jlo-talendcomp-excel" MODULE="jlo-talendcomp-excel-13.5.jar" MVN="mvn:org.talend.libraries/jlo-talendcomp-excel-13.5/6.0.0-SNAPSHOT" REQUIRED="true"/>
<IMPORT NAME="poi-ooxml" MODULE="poi-ooxml-4.1.2.jar" MVN="mvn:org.talend.libraries/poi-ooxml-4.1.2/6.0.0-SNAPSHOT" REQUIRED="true"/>
<IMPORT NAME="poi" MODULE="poi-4.1.2.jar" MVN="mvn:org.talend.libraries/poi-4.1.2/6.0.0-SNAPSHOT" REQUIRED="true"/>
<IMPORT NAME="commons-codec" MODULE="commons-codec-1.13.jar" MVN="mvn:org.talend.libraries/commons-codec-1.13/6.0.0-SNAPSHOT" REQUIRED="true"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>

<COMPONENT>
<HEADER AUTHOR="cimt AG" COMPATIBILITY="ALL" DATA_AUTO_PROPAGATE="false" PLATEFORM="ALL" RELEASE_DATE="20211217" SERIAL="" STARTABLE="true" STATUS="PROD" VERSION="13.4">
<HEADER AUTHOR="cimt AG" COMPATIBILITY="ALL" DATA_AUTO_PROPAGATE="false" PLATEFORM="ALL" RELEASE_DATE="20220523" SERIAL="" STARTABLE="true" STATUS="PROD" VERSION="13.5">
<SIGNATURE/>
</HEADER>
<FAMILIES>
Expand Down Expand Up @@ -50,8 +50,8 @@
<PARAMETER FIELD="CHECK" NAME="OPTIMZE_HSSF_WB_FONTS" NUM_ROW="30">
<DEFAULT>false</DEFAULT>
</PARAMETER>
<PARAMETER NAME="RELEASE_LABEL_20211217" FIELD="LABEL" COLOR="0;0;0" NUM_ROW="900">
<DEFAULT>Release: 13.4 build at: 20211217</DEFAULT>
<PARAMETER NAME="RELEASE_LABEL_20220523" FIELD="LABEL" COLOR="0;0;0" NUM_ROW="900">
<DEFAULT>Release: 13.5 build at: 20220523</DEFAULT>
</PARAMETER>
</ADVANCED_PARAMETERS>
<CODEGENERATION>
Expand Down

0 comments on commit d23fa62

Please sign in to comment.