You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by GitBox <gi...@apache.org> on 2022/09/06 08:40:38 UTC

[GitHub] [inlong] GanfengTan opened a new pull request, #5804: [INLONG-5803][Agent] Fix NPE when collect file data

GanfengTan opened a new pull request, #5804:
URL: https://github.com/apache/inlong/pull/5804

   Fix NPE
   - Fixes #5803 
   
   ### Motivation
   
   No message.
   
   ### Modifications
   
   No message.
   
   ### Verifying this change
   
   *(Please pick either of the following options)*
   
   - [x] This change is a trivial rework/code cleanup without any test coverage.
   
   - [ ] This change is already covered by existing tests, such as:
     *(please describe tests)*
   
   - [ ] This change added tests and can be verified as follows:


-- 
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: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [inlong] healchow commented on a diff in pull request #5804: [INLONG-5803][Agent] Fix NPE when collect file data

Posted by GitBox <gi...@apache.org>.
healchow commented on code in PR #5804:
URL: https://github.com/apache/inlong/pull/5804#discussion_r963435195


##########
inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/sources/reader/file/MonitorTextFile.java:
##########
@@ -111,17 +114,23 @@ public void run() {
                     }
                     listen();
                     TimeUnit.MILLISECONDS.sleep(interval);
-                } catch (Exception e) {
-                    LOGGER.error("monitor {} error:", this.fileReaderOperator.file.getName(), e);
                 }
+            } catch (Exception e) {
+                LOGGER.error("monitor {} error:", this.fileReaderOperator.file.getName(), e);
             }
         }
 
         private void listen() throws IOException {
             BasicFileAttributes attributesAfter = Files
                     .readAttributes(this.fileReaderOperator.file.toPath(), BasicFileAttributes.class);
-            if (attributesBefore.lastModifiedTime().compareTo(attributesAfter.lastModifiedTime()) < 0
-                    && !this.fileReaderOperator.iterator.hasNext()) {
+            if (attributesBefore.lastModifiedTime().compareTo(attributesAfter.lastModifiedTime()) < 0) {

Review Comment:
   Suggested adding a comment for the reason for return.



-- 
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: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [inlong] GanfengTan commented on a diff in pull request #5804: [INLONG-5803][Agent] Fix NPE when collect file data

Posted by GitBox <gi...@apache.org>.
GanfengTan commented on code in PR #5804:
URL: https://github.com/apache/inlong/pull/5804#discussion_r963454788


##########
inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/sources/reader/file/MonitorTextFile.java:
##########
@@ -76,6 +77,7 @@ public void monitor(FileReaderOperator fileReaderOperator, TextFileReader textFi
      */
     private class MonitorEventRunnable implements Runnable {
 
+        private static final int WAIT_TIME = 30;

Review Comment:
   Internal startup logical, don`t have to add configuration.



-- 
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: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [inlong] EMsnap commented on a diff in pull request #5804: [INLONG-5803][Agent] Fix NPE when collect file data

Posted by GitBox <gi...@apache.org>.
EMsnap commented on code in PR #5804:
URL: https://github.com/apache/inlong/pull/5804#discussion_r963449112


##########
inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/sources/reader/file/MonitorTextFile.java:
##########
@@ -76,6 +77,7 @@ public void monitor(FileReaderOperator fileReaderOperator, TextFileReader textFi
      */
     private class MonitorEventRunnable implements Runnable {
 
+        private static final int WAIT_TIME = 30;

Review Comment:
   add a configuration for the wait time pls



-- 
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: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [inlong] EMsnap merged pull request #5804: [INLONG-5803][Agent] Fix NPE when collect file data

Posted by GitBox <gi...@apache.org>.
EMsnap merged PR #5804:
URL: https://github.com/apache/inlong/pull/5804


-- 
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: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org