This is an automated email from the ASF dual-hosted git repository.
kirs pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-dolphinscheduler.git
The following commit(s) were added to refs/heads/dev by this push:
new c4d7544 [Fix-4271][server] Fix IOException or NoSuchFileException in
logger server (#4272)
c4d7544 is described below
commit c4d75443e14285c289334dd71365155c6d9625ea
Author: Shiwen Cheng <[email protected]>
AuthorDate: Mon Dec 21 09:07:49 2020 +0800
[Fix-4271][server] Fix IOException or NoSuchFileException in logger server
(#4272)
---
.../dolphinscheduler/server/log/LoggerRequestProcessor.java | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git
a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/log/LoggerRequestProcessor.java
b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/log/LoggerRequestProcessor.java
index b31785c..e9a85f4 100644
---
a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/log/LoggerRequestProcessor.java
+++
b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/log/LoggerRequestProcessor.java
@@ -169,10 +169,15 @@ public class LoggerRequestProcessor implements
NettyRequestProcessor {
private List<String> readPartFileContent(String filePath,
int skipLine,
int limit) {
- try (Stream<String> stream = Files.lines(Paths.get(filePath))) {
- return
stream.skip(skipLine).limit(limit).collect(Collectors.toList());
- } catch (IOException e) {
- logger.error("read file error",e);
+ File file = new File(filePath);
+ if (file.exists() && file.isFile()) {
+ try (Stream<String> stream = Files.lines(Paths.get(filePath))) {
+ return
stream.skip(skipLine).limit(limit).collect(Collectors.toList());
+ } catch (IOException e) {
+ logger.error("read file error",e);
+ }
+ } else {
+ logger.info("file path: {} not exists", filePath);
}
return Collections.emptyList();
}