Menu

#41 rgb parsing in function defect

0.9.11
closed
nobody
None
1
2013-12-26
2013-11-07
No

When parsing an rgb value in a function the result gets defect. The commas will be treated as parameters:

Input: -webkit(rgb(18,52,86))
Output: -webkit(rgb(18,,,52,,,86))

Reparsing the output leads to a NullPointerExeption after the first comma.

In LexicalUnitImpl the function appendParams should be changed to take the comma-parameter in consideration:

private void appendParams(final StringBuilder sb, final LexicalUnit first) {
    LexicalUnit l = first;
    boolean comma = false;
    while (l != null) {
+      if (l.getLexicalUnitType()!=SAC_OPERATOR_COMMA) {
          if (comma) {
            sb.append(",");
          }
          comma = true;
          sb.append(l.toString());
+       }
        l = l.getNextLexicalUnit();
    }
}

Discussion

  • Sascha Broich

    Sascha Broich - 2013-11-07
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -11,8 +11,8 @@
             LexicalUnit l = first;
             boolean comma = false;
             while (l != null) {
    ----            if (comma) {
    -+++            if (comma && l.getLexicalUnitType()!=SAC_OPERATOR_COMMA) {
    +    ---    if (comma) {
    +    +++    if (comma && l.getLexicalUnitType()!=SAC_OPERATOR_COMMA) {
                     sb.append(",");
                 }
                 comma = true;
    
     
  • RBRi

    RBRi - 2013-11-07
    • status: open --> accepted
     
  • Sascha Broich

    Sascha Broich - 2013-11-08
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -11,12 +11,13 @@
             LexicalUnit l = first;
             boolean comma = false;
             while (l != null) {
    -    ---    if (comma) {
    -    +++    if (comma && l.getLexicalUnitType()!=SAC_OPERATOR_COMMA) {
    +    +      if (l.getLexicalUnitType()!=SAC_OPERATOR_COMMA) {
    +              if (comma) {
                     sb.append(",");
    -            }
    -            comma = true;
    -            sb.append(l.toString());
    +              }
    +              comma = true;
    +              sb.append(l.toString());
    +    +       }
                 l = l.getNextLexicalUnit();
             }
         }
    
     
  • RBRi

    RBRi - 2013-12-26
    • status: accepted --> closed
     
  • RBRi

    RBRi - 2013-12-26

    Fixed in SVN

     

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.