drill-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] (DRILL-2618) BasicFormatMatcher calls getFirstPath(...) without checking # of paths is not zero
Date Fri, 20 Nov 2015 01:52:10 GMT

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

ASF GitHub Bot commented on DRILL-2618:
---------------------------------------

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

    https://github.com/apache/drill/pull/270#discussion_r45427970
  
    --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/FileSelection.java
---
    @@ -190,22 +136,40 @@ private static String commonPath(FileStatus... paths) {
             break;
           }
         }
    -    URI oneURI = paths[0].getPath().toUri();
    +    URI oneURI = statuses.get(0).getPath().toUri();
         return new Path(oneURI.getScheme(), oneURI.getAuthority(), commonPath).toString();
       }
     
    -  public static FileSelection create(DrillFileSystem fs, String parent, String path)
throws IOException {
    -    Path p = new Path(parent,removeLeadingSlash(path));
    -    FileStatus[] status = fs.globStatus(p);
    -    if (status == null || status.length == 0) {
    +  public static FileSelection create(final DrillFileSystem fs, final String parent, final
String path) throws IOException {
    +    final Path combined = new Path(parent, removeLeadingSlash(path));
    +    final FileStatus[] statuses = fs.globStatus(combined);
    +    if (statuses == null) {
    --- End diff --
    
    We handle null case explicitly here as we cannot create a List down when statuses is null.
In case statuses is empty, the delegate create returns `null` which is expected. Can you clarify
what you mean by failure?


> BasicFormatMatcher calls getFirstPath(...) without checking # of paths is not zero
> ----------------------------------------------------------------------------------
>
>                 Key: DRILL-2618
>                 URL: https://issues.apache.org/jira/browse/DRILL-2618
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Storage - Other
>            Reporter: Daniel Barclay (Drill)
>            Assignee: Deneche A. Hakim
>             Fix For: 1.4.0
>
>
> {{BasicFormatMatcher.isReadable(...)}} calls {{getFirstPath(...)}} without checking that
there is at least one path.  This can cause an IndexOutOfBoundsException.
> To reproduce, create an empty directory {{/tmp/CaseInsensitiveColumnNames}} and run {{exec/java-exec/src/test/java/org/apache/drill/TestExampleQueries.java}}.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message