-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[homematic] Remove dependency org.apache.commons.* from CcuGateway #10028
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Remove dependencies org.apache.commons.lang.StringUtils and org.apache.commons.lang.ObjectUtils from CcuGateway Signed-off-by: Paul Vogel <[email protected]>
pavog
commented
Feb 2, 2021
....homematic/src/main/java/org/openhab/binding/homematic/internal/communicator/CcuGateway.java
Show resolved
Hide resolved
cpmeister
requested changes
Feb 4, 2021
script = StringUtils.trim(script); | ||
if (StringUtils.isEmpty(script)) { | ||
script = script == null ? null : script.trim(); | ||
if (script == null || script.length() == 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested change
if (script == null || script.length() == 0) { | |
if (script == null || script.isEmpty()) { |
@@ -210,7 +213,14 @@ protected void executeScript(HmDatapoint dp) throws IOException { | |||
.header(HttpHeader.CONTENT_TYPE, "text/plain;charset=" + config.getEncoding()).send(); | |||
|
|||
String result = new String(response.getContent(), config.getEncoding()); | |||
result = StringUtils.substringBeforeLast(result, "<xml><exec>"); | |||
if (result.length() != 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested change
if (result.length() != 0) { | |
if (!result.isEmpty()) { |
result.put(script.name, StringUtils.trimToNull(script.data)); | ||
// trim data to null (if it's empty) | ||
String data = script.data == null ? null : script.data.trim(); | ||
data = (data == null || data.length() == 0) ? null : data; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested change
data = (data == null || data.length() == 0) ? null : data; | |
data = (data == null || data.isEmpty()) ? null : data; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This removes the dependencies org.apache.commons.lang.StringUtils and org.apache.commons.lang.ObjectUtils from CcuGateway
This replaces the functions from StringUtils and ObjectUtils with standard Java functions.
In most cases the functions from StringUtils just cover standard Java functions with null or empty-string checks.
Related to #7722