flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FLINK-8473) JarListHandler may fail with NPE if directory is deleted
Date Mon, 22 Jan 2018 13:18:00 GMT

    [ https://issues.apache.org/jira/browse/FLINK-8473?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16334242#comment-16334242
] 

ASF GitHub Bot commented on FLINK-8473:
---------------------------------------

Github user uce commented on a diff in the pull request:

    https://github.com/apache/flink/pull/5331#discussion_r162932050
  
    --- Diff: flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/handlers/JarListHandler.java
---
    @@ -145,6 +155,7 @@ public boolean accept(File dir, String name) {
     					return writer.toString();
     				}
     				catch (Exception e) {
    +					LOG.warn("Failed to fetch jar list.", e);
    --- End diff --
    
    Aren't failed completions logged anyways?


> JarListHandler may fail with NPE if directory is deleted
> --------------------------------------------------------
>
>                 Key: FLINK-8473
>                 URL: https://issues.apache.org/jira/browse/FLINK-8473
>             Project: Flink
>          Issue Type: Improvement
>          Components: Webfrontend
>    Affects Versions: 1.4.0, 1.5.0
>            Reporter: Chesnay Schepler
>            Assignee: Chesnay Schepler
>            Priority: Major
>             Fix For: 1.5.0, 1.4.1
>
>
> The JarListHandler is responsible for listing all jars that have been uploaded via the
webUI. Uploaded jars are stored in a temporary directory, and the handler simply iterates
over the contents of this directory to create the listing.
>  
> {code:java}
> File[] list = jarDir.listFiles(new FilenameFilter() {
>    @Override
>    public boolean accept(File dir, String name) {
>       return name.endsWith(".jar");
>    }
> });
> // last modified ascending order
> Arrays.sort(list, (f1, f2) -> Long.compare(f2.lastModified(), f1.lastModified()));{code}
> This code will fail with a {{NullPointerException}} if the directory was deleted (like
as part of some automatic cleanup). File#listFiles returns null in this case causing Arrays.sort
to throw the NPE.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message