Skip to content

Commit

Permalink
Fixes #1024: Do not use Guava APIs for simple things
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Tzvetanov Grigorov <[email protected]>
(cherry picked from commit e2cb570)
  • Loading branch information
martin-g committed Dec 13, 2023
1 parent 1961eac commit dd6874d
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
import org.apache.wicket.markup.ComponentTag;
import org.apache.wicket.util.lang.Args;

import static com.google.common.base.Strings.isNullOrEmpty;

/**
* <h1>Component behavior.</h1>
* <p>This behavior adds an attribute to DOM element with feedback message.</p>
Expand All @@ -20,7 +18,7 @@
class FeedbackMessageBehavior extends Behavior {

private static final long serialVersionUID = 3116618186507530804L;
private String attributeName;
private final String attributeName;

/**
* Construct.
Expand All @@ -35,18 +33,18 @@ class FeedbackMessageBehavior extends Behavior {
@Override
public void onComponentTag(Component component, ComponentTag tag) {
FeedbackMessages messages = component.getFeedbackMessages();
if (messages != null && messages.size() > 0) {
if (messages != null && !messages.isEmpty()) {
StringBuilder sb = new StringBuilder();
for (FeedbackMessage message : messages.messages(ErrorLevelFeedbackMessageFilter.ALL)) {
if (!message.isRendered()) {
String msg = message.getMessage().toString();
if (!isNullOrEmpty(msg)) {
if (msg != null && !msg.isEmpty()) {
sb.append(msg);
}
}
}
String messageString = sb.toString();
if (!isNullOrEmpty(messageString)) {
if (!messageString.isEmpty()) {
tag.getAttributes().put(attributeName, messageString);
}
}
Expand Down

0 comments on commit dd6874d

Please sign in to comment.