Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue for getIsExternallyOwned() for Files and Folders #808

Merged
merged 4 commits into from May 19, 2020

Conversation

sujaygarlanka
Copy link
Contributor

@sujaygarlanka sujaygarlanka commented May 19, 2020

Calling getIsExternallyOwned() on File.Info object or Folder.info would cause an exception when the value is null. This is because the return type for the method was a boolean, but the value being returned was a Boolean. So when the Boolean has value null, the value could not be cast to a primitive and would throw an exception. This issue was brought up in #805.

This is fixed by changing the type of the value being returned from a Boolean to a boolean.

@coveralls
Copy link

coveralls commented May 19, 2020

Pull Request Test Coverage Report for Build 2209

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 7 unchanged lines in 3 files lost coverage.
  • Overall coverage remained the same at 65.623%

Files with Coverage Reduction New Missed Lines %
src/main/java/com/box/sdk/BoxAPIRequest.java 2 65.38%
src/main/java/com/box/sdk/BoxAPIResponse.java 2 57.25%
src/main/java/com/box/sdk/RealtimeServerConnection.java 3 80.0%
Totals Coverage Status
Change from base Build 2202: 0.0%
Covered Lines: 5532
Relevant Lines: 8430

💛 - Coveralls

@sujaygarlanka sujaygarlanka merged commit 5ef5468 into master May 19, 2020
@sujaygarlanka sujaygarlanka deleted the null-pointer-exception branch May 19, 2020 19:37
@jacquesvandermerwe
Copy link

jacquesvandermerwe commented Jun 25, 2020

@sujaygarlanka, @PJSimon whilst this works it now returns the wrong value. The results from the Java SDK vs. the CLI for the same folder return true (correct) in the CLI and 'false' (incorrect) in SDK 2.48.0. So no more nullpointer but the wrong result.

UPDATE When Folder Info is requested is_externally_owned is not returned as part of the standard fields so will always be false. To get that returned you have to specifically request is_externally_owned as part of the field request. This might cause an issue if users aren't aware of this. The options would be to either have it not set (which boolean doesn't support) or when the method is called fetch this field explicitly.

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.

None yet

4 participants