Uploaded image for project: 'Beam'
  1. Beam
  2. BEAM-2369

HadoopFileSystem: NullPointerException on match of non existing resource

Details

    • Bug
    • Status: Resolved
    • P2
    • Resolution: Fixed
    • 2.0.0
    • 2.1.0
    • None

    Description

      Testcase:

        @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());
        }
      

      throws NullPointerException

      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)
      

      as the underlying hadoop implementation returns null:

           * 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.
      

      Attachments

        Issue Links

          Activity

            People

              michel Michael Luckey
              michel Michael Luckey
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: