Skip to content

[BEAM-59] Add getFilename method to ResourceId#2754

Closed
vikkyrk wants to merge 4 commits intoapache:masterfrom
vikkyrk:resource_name
Closed

[BEAM-59] Add getFilename method to ResourceId#2754
vikkyrk wants to merge 4 commits intoapache:masterfrom
vikkyrk:resource_name

Conversation

@vikkyrk
Copy link
Contributor

@vikkyrk vikkyrk commented Apr 27, 2017

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. (Even better, enable
    Travis-CI on your fork and ensure the whole test matrix passes).
  • 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.

@vikkyrk
Copy link
Contributor Author

vikkyrk commented Apr 27, 2017

R: @dhalperi

}

@Override
public String getFilename() {
Copy link
Contributor

Choose a reason for hiding this comment

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

if it can return null, add @Nullable

* @return a string representing the name of file or directory, or null if there are zero
* components.
*/
String getFilename();
Copy link
Contributor

Choose a reason for hiding this comment

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

@Nullable

}

@Override
public String getFilename() {
Copy link
Contributor

Choose a reason for hiding this comment

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

@Nullable

"abc");
assertEquals(toResourceIdentifier("gs://my_bucket/abc/xyz.txt").getFilename(),
"xyz.txt");

Copy link
Contributor

Choose a reason for hiding this comment

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

drop blank line

return gcsPath.getBucket();
} else {
return gcsPath.getFileName().toString();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel like this should return null for <= 1 and never return bucket -- gs://bucket/ is equivalent to / , right?

Copy link
Contributor

Choose a reason for hiding this comment

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

Not 100% convinced tho.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I was in two minds but included the bucket as it is part of the hierarchical component. I was going with anything after the the scheme should be included.

Copy link
Contributor

Choose a reason for hiding this comment

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

On deeper thought, I think bucket should be treated like / and omitted here. Quick poll around the office -- everyone agreed.

Also, build didn't pass?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@dhalperi
Copy link
Contributor

Look into the build error?

Also, please title PR with BEAM not Beam -- the ASF bots look specifically for all caps to update the issues.

@vikkyrk vikkyrk changed the title [Beam-59] Add getFilename method to ResourceId [BEAM-59] Add getFilename method to ResourceId Apr 28, 2017
@vikkyrk
Copy link
Contributor Author

vikkyrk commented Apr 28, 2017

Done. (It was findbugs complaining. )

@asfgit asfgit closed this in a8a04a2 Apr 28, 2017
@coveralls
Copy link

Coverage Status

Coverage increased (+0.003%) to 69.688% when pulling e6992c8 on vikkyrk:resource_name into 47aaf11 on apache:master.

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