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

[plugwise] Remove org.apache.common #14432

Merged
merged 2 commits into from
Mar 3, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.apache.commons.lang3.StringUtils;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.binding.plugwise.internal.protocol.AcknowledgementMessage;
Expand Down Expand Up @@ -95,7 +94,7 @@ public PlugwiseMessageProcessor(PlugwiseCommunicationContext context) {
*/
private void parseAndQueue(ByteBuffer readBuffer) {
String response = new String(readBuffer.array(), 0, readBuffer.limit());
response = StringUtils.chomp(response);
response = response.replaceAll("\r", "").replaceAll("\n", "");

Matcher matcher = RESPONSE_PATTERN.matcher(response);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
import java.time.format.DateTimeFormatter;
import java.util.Map;

import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.text.WordUtils;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.binding.plugwise.internal.protocol.InformationResponseMessage;
Expand Down Expand Up @@ -102,7 +100,18 @@ public static void stopBackgroundThread(@Nullable Thread thread) {
}

public static String upperUnderscoreToLowerCamel(String text) {
String upperCamel = StringUtils.remove(WordUtils.capitalizeFully(text, new char[] { '_' }), "_");
final String delimiter = "_";
String upperCamel = "";
for (String str : text.split(delimiter)) {
String properlyCapitalized = "";
if (str.length() > 0) {
properlyCapitalized = str.substring(0, 1).toUpperCase();
}
if (str.length() > 1) {
properlyCapitalized = str.substring(1).toLowerCase();
lsiepel marked this conversation as resolved.
Show resolved Hide resolved
}
upperCamel = upperCamel + properlyCapitalized;
}
return upperCamel.substring(0, 1).toLowerCase() + upperCamel.substring(1);
}

Expand Down