You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Max van den Aker (JIRA)" <ji...@apache.org> on 2018/07/09 11:19:00 UTC

[jira] [Created] (WICKET-6567) Concatenation of semicolons in FormComponent's inputChanged method

Max van den Aker created WICKET-6567:
----------------------------------------

             Summary: Concatenation of semicolons in FormComponent's inputChanged method
                 Key: WICKET-6567
                 URL: https://issues.apache.org/jira/browse/WICKET-6567
             Project: Wicket
          Issue Type: Bug
          Components: wicket
    Affects Versions: 6.29.0
            Reporter: Max van den Aker


 
{code:java}
public final void inputChanged() {
  if (this.isVisibleInHierarchy() && this.isEnabledInHierarchy()) {
    String[] input = this.getInputAsArray();
    if (input != null && input.length > 0 && input[0] != null) {
      this.rawInput = StringList.valueOf(input).join(";");
    } else if (this.isInputNullable()) {
    this.rawInput = null;
    } else {
      this.rawInput = "[-NO-RAW-INPUT-]";
    }
  }
}
{code}
In the implementation listed above, occasionally this will join an array of empty strings, and result in this.rawInput = ";", and on each subsequent invocation adds another semicolon to rawInput.

A fix might be to consider !input[0].isEmpty() in the condition as well:
{code:java}
public final void inputChanged() {
  if (this.isVisibleInHierarchy() && this.isEnabledInHierarchy()) {
    String[] input = this.getInputAsArray();
    if (input != null && input.length > 0 && input[0] != null && !input[0].isEmpty()) {
      this.rawInput = StringList.valueOf(input).join(";");
    } else if (this.isInputNullable()) {
    this.rawInput = null;
    } else {
      this.rawInput = "[-NO-RAW-INPUT-]";
    }
  }
}
{code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)