CalvinKirs commented on a change in pull request #4943:
URL:
https://github.com/apache/incubator-dolphinscheduler/pull/4943#discussion_r589389593
##########
File path:
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/LoggerUtils.java
##########
@@ -101,6 +108,26 @@ public static String buildTaskId(String affix,
return appIds;
}
+ /**
+ * read whole file content
+ *
+ * @param filePath file path
+ * @return whole file content
+ */
+ public static String readWholeFileContent(String filePath) {
+ String line;
+ StringBuilder sb = new StringBuilder();
+ try (BufferedReader br = new BufferedReader(new InputStreamReader(new
FileInputStream(filePath)))) {
+ while ((line = br.readLine()) != null) {
+ sb.append(line + "\r\n");
+ }
+ return sb.toString();
+ } catch (IOException e) {
+ logger.error("read file error", e);
+ }
+ return "";
+ }
Review comment:
Did you forget to close the stream?
----------------------------------------------------------------
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]