Uploaded image for project: 'Shindig'
  1. Shindig
  2. SHINDIG-1540

Message string in MessageBundle gets mangled (trimmed) in shindig

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.5.0-beta2
    • Component/s: Java
    • Labels:
      None

      Description

      I have a gadget whose message bundle includes the following entry:
      <msg name="orange" desc="Color, approximately #E69B1E">
      orange
      </msg>

      The value of that message should be "\norange\n", but shindig appears to be trimming the whitespace around the message's value.

      Shindig is not following the spec, which states that the msg element extends xs:string, and NOT xs:normalizedString:

      <xs:element name="messagebundle">
      <xs:complexType>
      <xs:sequence>
      <xs:element name="msg" minOccurs="0" maxOccurs="unbounded">
      <xs:complexType>
      <xs:simpleContent>
      <xs:extension base="xs:string">
      <xs:attribute name="name" type="xs:string" use="required"/>
      <xs:attribute name="desc" type="xs:string" use="optional"/>
      </xs:extension>
      </xs:simpleContent>
      </xs:complexType>
      </xs:element>
      </xs:sequence>
      </xs:complexType>
      </xs:element>

      See:
      http://www.w3schools.com/Schema/schema_dtypes_string.asp

        Activity

        Hide
        jiangran Ran Jiang added a comment -

        This is due to trim() method being called in MessageBundle.java

        line 172: "messages.put(name, sw.toString().trim());"

        Show
        jiangran Ran Jiang added a comment - This is due to trim() method being called in MessageBundle.java line 172: "messages.put(name, sw.toString().trim());"
        Hide
        jiraposter@reviews.apache.org jiraposter@reviews.apache.org added a comment -

        -----------------------------------------------------------
        This is an automatically generated e-mail. To reply, visit:
        https://reviews.apache.org/r/4786/
        -----------------------------------------------------------

        Review request for shindig.

        Summary
        -------

        line 172 in MessageBundle.java:
        "message.put(name, sw.toString().trim())"
        The "trim()" method trim the whitespace around the message's value, which result in returning the wrong value.

        This addresses bug SHINDIG-1540.
        https://issues.apache.org/jira/browse/SHINDIG-1540

        Diffs


        Diff: https://reviews.apache.org/r/4786/diff

        Testing
        -------

        Done

        Thanks,

        Ran

        Show
        jiraposter@reviews.apache.org jiraposter@reviews.apache.org added a comment - ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/4786/ ----------------------------------------------------------- Review request for shindig. Summary ------- line 172 in MessageBundle.java: "message.put(name, sw.toString().trim())" The "trim()" method trim the whitespace around the message's value, which result in returning the wrong value. This addresses bug SHINDIG-1540 . https://issues.apache.org/jira/browse/SHINDIG-1540 Diffs Diff: https://reviews.apache.org/r/4786/diff Testing ------- Done Thanks, Ran
        Hide
        hsaputra Henry Saputra added a comment -

        +1

        Show
        hsaputra Henry Saputra added a comment - +1
        Hide
        ssievers Stanton Sievers added a comment -

        Committed revision 1327901.

        Show
        ssievers Stanton Sievers added a comment - Committed revision 1327901.

          People

          • Assignee:
            Unassigned
            Reporter:
            randy.hudson Randy Hudson
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development