zhtk commented on code in PR #9874:
URL: https://github.com/apache/nifi/pull/9874#discussion_r2079799098


##########
nifi-extension-bundles/nifi-poi-bundle/nifi-poi-services/src/main/java/org/apache/nifi/excel/RowIterator.java:
##########
@@ -42,13 +44,26 @@ class RowIterator implements Iterator<Row>, Closeable {
     private Row currentRow;
 
     RowIterator(final InputStream in, final ExcelRecordReaderConfiguration 
configuration, final ComponentLog logger) {
-        this.workbook = StreamingReader.builder()
-                .rowCacheSize(100)
-                .bufferSize(4096)
-                .password(configuration.getPassword())
-                .setAvoidTempFiles(configuration.isAvoidTempFiles())
-                .setReadSharedFormulas(true) // NOTE: If not set to true, then 
data with shared formulas fail.
-                .open(in);
+        if (configuration.getInputFileType() == InputFileType.XLSX) {

Review Comment:
   Keeping as is, but switch also makes sense here



##########
nifi-extension-bundles/nifi-poi-bundle/nifi-poi-services/src/test/java/org/apache/nifi/excel/TestExcelRecordReader.java:
##########
@@ -122,20 +112,32 @@ public void testNonExcelFile() {
 
         MalformedRecordException mre = 
assertThrows(MalformedRecordException.class, () -> new 
ExcelRecordReader(configuration, getInputStream("notExcel.txt"), logger));
         final Throwable cause = mre.getCause();
-        assertInstanceOf(ReadException.class, cause);
+        assertInstanceOf(ProcessException.class, cause);
     }
 
     @Test
-    public void testOlderExcelFormatFile() {
-        ExcelRecordReaderConfiguration configuration = new 
ExcelRecordReaderConfiguration.Builder().build();
-        MalformedRecordException mre = 
assertThrows(MalformedRecordException.class, () -> new 
ExcelRecordReader(configuration, getInputStream("olderFormat.xls"), logger));
-        assertTrue(ExceptionUtils.getStackTrace(mre).contains("data appears to 
be in the OLE2 Format"));
+    public void testOlderExcelFormatFile() throws MalformedRecordException {
+        final List<RecordField> fields = Arrays.asList(

Review Comment:
   Changed



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to