Skip to content

BEAM-2369 HadoopFileSystem: prevent NPE on match of non existing file#3237

Closed
adude3141 wants to merge 1 commit into
apache:masterfrom
adude3141:BEAM-2369
Closed

BEAM-2369 HadoopFileSystem: prevent NPE on match of non existing file#3237
adude3141 wants to merge 1 commit into
apache:masterfrom
adude3141:BEAM-2369

Conversation

@adude3141
Copy link
Copy Markdown
Contributor

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.

Hi @lukecwik, @dhalperi, plz have a look

try {
FileStatus[] fileStatuses = fileSystem.globStatus(new Path(spec));
if (fileStatuses == null) {
return resultsBuilder.add(MatchResult.create(Status.NOT_FOUND,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you want to return here yet, we should look up the rest of the results requested in the specs list.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dooh, of course

// ensure files exist
assertArrayEquals("testDataAA".getBytes(), read("testFileAA"));

List<MatchResult> matchResults = fileSystem.match(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test with a list of requested matches.

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 70.797% when pulling 350c6b7 on adude3141:BEAM-2369 into c687887 on apache:master.

Copy link
Copy Markdown
Member

@lukecwik lukecwik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM

@asfgit asfgit closed this in b0fb5b2 May 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants