0 Replies Latest reply on Feb 29, 2012 9:44 AM by Volodymyr Shynkliar

    RichFaces Filter removes whitespaces in attributes - is it a bug ?

    Volodymyr Shynkliar Newbie

      Hello,

       

      I found that RichFaces Filter removes extra workspaces in html attributes.

       

      Imagine that you have a <rich:tabPanel> with ajax swithing mode and a select element on some tab with option like <option value="A     five spaces option">5</option>. After passing through RichFaces Filter the extra spaces will be removed and the output will be <option value="A five spaces option">5</option>. If you select this value and submit the form it just would't pass JSF validation, because component knows about "A     five spaces option" value but not about "A five spaces option".

       

      After some digging I found where this transformation occurs. There are method parseValue() in org.ajax4jsf.org.w3c.tidy.Lexer class with the following code fragment:

                     

                     if (munge)

                      {

                          // discard line breaks in quoted URLs

                          // #438650 - fix by Randy Waki

                          if (c == '\n' && AttributeTable.getDefaultAttributeTable().isUrl(name))

                          {

                              // warn that we discard this newline

                              report.attrError(this, this.token, null, Report.NEWLINE_IN_URI);

                              continue;

                          }

       

       

                          c = ' ';

       

       

                          if (lastc == ' ')

                          {

                              continue;

                          }

                      }

       

      Maybe it make sence to remove lines marked red ?

       

      Regards,

      Volodymyr