[
https://issues.apache.org/jira/browse/BEAM-2369?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Luke Cwik resolved BEAM-2369.
-----------------------------
Resolution: Fixed
> 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-extensions
> Affects Versions: 2.0.0
> Reporter: Michael Luckey
> Assignee: Michael Luckey
> Fix For: 2.1.0
>
>
> 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)