[
https://issues.apache.org/jira/browse/DRILL-2618?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15014754#comment-15014754
]
ASF GitHub Bot commented on DRILL-2618:
---------------------------------------
Github user adeneche commented on a diff in the pull request:
https://github.com/apache/drill/pull/270#discussion_r45417180
--- 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 --
is it possible to have `statuses.length == 0` ? in this case the call to
`create()` below will fail
> 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)