Skip to content

Simplify some if statements in StringUtils.#521

Merged
garydgregory merged 4 commits intoapache:masterfrom
Isira-Seneviratne:Simplify_StringUtils_if_statements
Apr 20, 2020
Merged

Simplify some if statements in StringUtils.#521
garydgregory merged 4 commits intoapache:masterfrom
Isira-Seneviratne:Simplify_StringUtils_if_statements

Conversation

@Isira-Seneviratne
Copy link
Contributor

No description provided.

@coveralls
Copy link

coveralls commented Apr 20, 2020

Coverage Status

Coverage decreased (-0.0009%) to 95.093% when pulling a7c92a6 on Isira-Seneviratne:Simplify_StringUtils_if_statements into 7f45b88 on apache:master.

@Isira-Seneviratne Isira-Seneviratne force-pushed the Simplify_StringUtils_if_statements branch from 560d0c2 to a7c92a6 Compare April 20, 2020 02:06
} else if (isNotEmpty(str) && EMPTY.equals(abbrevMarker) && maxWidth > 0) {
return str.substring(0, maxWidth);
} else if (isEmpty(str) || isEmpty(abbrevMarker)) {
if (isNotEmpty(str) && EMPTY.equals(abbrevMarker) && maxWidth > 0) {
Copy link
Member

Choose a reason for hiding this comment

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

How about EMPTY.equals(abbrevMarker) -> isEmpty(abbrevMarker) ?

Copy link
Contributor Author

@Isira-Seneviratne Isira-Seneviratne Apr 20, 2020

Choose a reason for hiding this comment

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

That change would mean that abbrevMarker is potentially null, according to SonarLint.

Copy link
Member

Choose a reason for hiding this comment

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

@Isira-Seneviratne You are correct!

@garydgregory garydgregory merged commit 675d30d into apache:master Apr 20, 2020
asfgit pushed a commit that referenced this pull request Apr 20, 2020
@Isira-Seneviratne Isira-Seneviratne deleted the Simplify_StringUtils_if_statements branch April 20, 2020 22:40
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