Skip to content

Harden CapabilityBooleanType: can never be null#452

Merged
tobiasKaminsky merged 1 commit into
masterfrom
cbtNonNull
Jun 10, 2020
Merged

Harden CapabilityBooleanType: can never be null#452
tobiasKaminsky merged 1 commit into
masterfrom
cbtNonNull

Conversation

@tobiasKaminsky

Copy link
Copy Markdown
Member

Fix nextcloud/android#5045

Signed-off-by: tobiasKaminsky tobias@kaminsky.me

@codecov

codecov Bot commented Jun 9, 2020

Copy link
Copy Markdown

Codecov Report

Merging #452 into master will increase coverage by 0.06%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #452      +/-   ##
==========================================
+ Coverage   39.44%   39.50%   +0.06%     
==========================================
  Files         136      136              
  Lines        5895     5895              
  Branches      771      771              
==========================================
+ Hits         2325     2329       +4     
+ Misses       3226     3218       -8     
- Partials      344      348       +4     
Impacted Files Coverage Δ
...id/lib/resources/status/CapabilityBooleanType.java 81.25% <100.00%> (+37.50%) ⬆️
...wncloud/android/lib/resources/files/FileUtils.java 71.42% <0.00%> (-14.29%) ⬇️

AndyScherzinger
AndyScherzinger previously approved these changes Jun 9, 2020
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>

Copy link
Copy Markdown
Collaborator

Codacy Here is an overview of what got changed by this pull request:

Complexity increasing per file
==============================
- src/test/java/com/owncloud/android/lib/resources/status/CapabilityBooleanTypeTest.java  1
         

See the complete overview on Codacy

@nextcloud-android-bot

Copy link
Copy Markdown
Collaborator

Lint

TypemasterPR
Warnings22
Errors00

SpotBugs (new)

Warning TypeNumber
Bad practice Warnings14
Correctness Warnings38
Internationalization Warnings6
Malicious code vulnerability Warnings7
Multithreaded correctness Warnings3
Performance Warnings17
Security Warnings1
Dodgy code Warnings41
Total127

SpotBugs (master)

Warning TypeNumber
Bad practice Warnings14
Correctness Warnings38
Internationalization Warnings6
Malicious code vulnerability Warnings7
Multithreaded correctness Warnings3
Performance Warnings17
Security Warnings1
Dodgy code Warnings41
Total127

return TRUE;
}
return null;
return UNKNOWN;

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.

for the key you could then just go for UNKNOWN.getValue() etc. instead of duplicating the int-values here :)


public boolean isUnknown(){
public boolean isUnknown() {
return getValue() == -1;

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.

same here UNKNOWN.getValue() or maybe UNKNOWN.value, same for the other checks

@AndyScherzinger

Copy link
Copy Markdown
Member

@tobiasKaminsky been nitpicking a bit, feel free to skip my latest comments or apply them :)

@tobiasKaminsky
tobiasKaminsky merged commit b39932a into master Jun 10, 2020
@delete-merged-branch
delete-merged-branch Bot deleted the cbtNonNull branch June 10, 2020 05:40
@AndyScherzinger AndyScherzinger added this to the NC Android lib 2.3.0 milestone Jun 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CapabilityBooleanType.fromValue can return null

3 participants