pnowojski commented on a change in pull request #11071: [FLINK-16019][runtime] 
fix ContinuousFileReaderOperator error reporting
URL: https://github.com/apache/flink/pull/11071#discussion_r381941153
 
 

 ##########
 File path: 
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/ContinuousFileReaderOperator.java
 ##########
 @@ -449,7 +450,7 @@ private void cleanUp() {
                        try {
                                r.run();
                        } catch (Exception e) {
-                               firstException = 
ExceptionUtils.firstOrSuppressed(firstException, e);
+                               firstException = 
ExceptionUtils.firstOrSuppressed(e, firstException);
 
 Review comment:
   Potential test doesn't look difficult:
   
   ```
        @Test(expected = ExpectedTestException.class)
        public void test() throws Exception {
                // duplicated setup code
                TextInputFormat format = new TextInputFormat(new 
Path(testBasePath)) {
                        @Override
                        public void close() {
                                throw new ExpectedTestException();
                        }
                };
           // more duplicated code that could be deduplicated
                try 
(OneInputStreamOperatorTestHarness<TimestampedFileInputSplit, String> tester = 
...) {
                        tester.open();
                }
   }
   ```
   It's also reliable, assuming we get rid of the `FlinkRuntimeException` 
wrapping, which looks unnecessary.
   
   That's ~10 lines of simple code after deduplication?

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

Reply via email to