[ 
https://issues.apache.org/struts/browse/STR-2997?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_39955
 ] 

Henri Yandell commented on STR-2997:
------------------------------------

Digging into this more, it appears to be because the charVocabulary is not 
being set. Every char referenced in the antlr grammer is implicitly added to 
the charVocabulary, and when you say "~f", it means every char other than f 
__in the charVocabulary__. So the reason you don't see the other characters is 
that they've not been added to the charVocabulary yet.

I'll post in a bit with a recommended fix, once I figure out the correct way to 
generate the .g file into the .java file. I don't think the Struts trunk build 
is doing it automatically yet.

> [validator] validwhen strings don't work right
> ----------------------------------------------
>
>                 Key: STR-2997
>                 URL: https://issues.apache.org/struts/browse/STR-2997
>             Project: Struts 1
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.2.4, 1.2.9
>            Reporter: Eric Haszlakiewicz
>
> I originally noticed this problem with struts 1.2.4, but upgrading to 1.2.9 
> didn't fix it.  I can't upgrade to 1.3.5 right now so I don't know if it 
> still exists there or not.
> It seems that the content of string that is usable by the validwhen validator 
> is oddly limited.  It only appears to allow letters and a few other random 
> characters.  This makes the validator mostly useless.
> I tried to define a field validation using the validwhen validator:
> <field property="myfield" depends="validwhen">
>      <arg0 key="prop.myfield"/>
>       <var>
>             <var-name>test</var-name>
>             <var-value>(otherfield != "foo:bar")</var-value>
>       </var>
> </field>
> I got an error that looked like this:
> ValidWhen Error for field ' myfield' - line 1:20: expecting ''', found ':'
> I tried it with a few other characters, but there didn't seem to be any 
> pattern to what is allowed and what isn't.
> not ok:
>     :@#$%^&;,/+
> ok:
>     *().<>-_=
> (not a comprehensive list, I didn't try everything)
> I tried using both single and double quotes, but it didn't seem to make a 
> difference.
> This problem seems to have been mentioned on the mailing lists a few times, 
> but I wasn't able to find any answers.
> Looking at the definition of STRING_LITERAL in ValidWhenParser.g, it seems 
> like any non-quote character should be allowed:
>  
> STRING_LITERAL : ('\'' (~'\'')+ '\'') | ('\"' (~'\"')+ '\"') ;

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to