[
https://issues.apache.org/jira/browse/BEAM-2369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16026304#comment-16026304
]
ASF GitHub Bot commented on BEAM-2369:
--------------------------------------
GitHub user adude3141 opened a pull request:
https://github.com/apache/beam/pull/3237
BEAM-2369 HadoopFileSystem: prevent NPE on match of non existing file
Be sure to do all of the following to help us incorporate your contribution
quickly and easily:
- [ ] Make sure the PR title is formatted like:
`[BEAM-<Jira issue #>] Description of pull request`
- [ ] Make sure tests pass via `mvn clean verify`.
- [ ] Replace `<Jira issue #>` in the title with the actual Jira issue
number, if there is one.
- [ ] If this contribution is large, please file an Apache
[Individual Contributor License
Agreement](https://www.apache.org/licenses/icla.pdf).
---
Hi @lukecwik, @dhalperi, plz have a look
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/adude3141/beam BEAM-2369
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/beam/pull/3237.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #3237
----
commit 84a10d10e7623f3a681d823759d7ccda7d61fb08
Author: Michael Luckey <[email protected]>
Date: 2017-05-26T13:52:42Z
BEAM-2369 HadoopFileSystem: prevent NPE on match of non existing file
----
> HadoopFileSystem: NullPointerException on match of non existing resource
> ------------------------------------------------------------------------
>
> Key: BEAM-2369
> URL: https://issues.apache.org/jira/browse/BEAM-2369
> Project: Beam
> Issue Type: Bug
> Components: sdk-java-core
> Affects Versions: 2.0.0
> Reporter: Michael Luckey
> Assignee: Davor Bonaci
>
> Testcase:
> {code}
> @Test
> public void testMatchForNonExistentFile() throws Exception {
> create("testFileAA", "testDataAA".getBytes());
> // ensure files exist
> assertArrayEquals("testDataAA".getBytes(), read("testFileAA"));
> List<MatchResult> matchResults = fileSystem.match(
> ImmutableList.of(testPath("testFileA").toString()));
> assertEquals(Status.NOT_FOUND,
> Iterables.getOnlyElement(matchResults).status());
> }
> {code}
> throws NullPointerException
> {noformat}
> java.lang.NullPointerException
> at
> org.apache.beam.sdk.io.hdfs.HadoopFileSystem.match(HadoopFileSystem.java:87)
> at
> org.apache.beam.sdk.io.hdfs.HadoopFileSystemTest.testMatchForNonExistentFile(HadoopFileSystemTest.java:187)
> {noformat}
> as the underlying hadoop implementation returns null:
> {noformat}
> * When the input pattern "looks" like just a simple filename, and we
> * can't find it, we return null rather than an empty array.
> * This is a special case which the shell relies on.
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)