vvysotskyi commented on a change in pull request #1991: DRILL-7514: Update
Apache POI to Latest Version
URL: https://github.com/apache/drill/pull/1991#discussion_r382132759
##########
File path:
contrib/format-excel/src/main/java/org/apache/drill/exec/store/excel/ExcelBatchReader.java
##########
@@ -273,7 +273,12 @@ private int getColumnCount() {
int columnCount;
if (readerConfig.headerRow >= 0) {
- columnCount =
sheet.getRow(sheet.getFirstRowNum()).getPhysicalNumberOfCells();
+ try {
+ columnCount =
sheet.getRow(sheet.getFirstRowNum()).getPhysicalNumberOfCells();
+ } catch (NullPointerException e) {
Review comment:
It is a bad practice to catch NPE instead of adding a check for null. If I
understand the API correctly, `sheet.getRow(sheet.getFirstRowNum())` may return
null for the case when row is not defined. Could you please add check for null
there?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services