You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Numa Schmeder (JIRA)" <de...@tapestry.apache.org> on 2008/02/08 14:18:07 UTC

[jira] Commented: (TAPESTRY-2139) Using ValidField and Validator triggers null point exception

    [ https://issues.apache.org/jira/browse/TAPESTRY-2139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12567033#action_12567033 ] 

Numa Schmeder commented on TAPESTRY-2139:
-----------------------------------------

The code I gave fixes the problem in the java files but not all, for the javascript file.
I am working on correcting the javascript files of every validator.

> Using ValidField and Validator triggers null point exception
> ------------------------------------------------------------
>
>                 Key: TAPESTRY-2139
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2139
>             Project: Tapestry
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: 4.1
>         Environment: Macos X, java 1.4
>            Reporter: Numa Schmeder
>
> Hello,
> There is a small bug:
> Description:
> Using deprecated component ValidField,  a validation bean (IValidator), and enable javascript for this validator, then there is a null pointer exception.
> java.lang.NullPointerException
> Stack Trace:
> org.apache.tapestry.valid.BaseValidator.processValidatorScript(BaseValidator.java:292)
> org.apache.tapestry.valid.StringValidator.renderValidatorContribution(StringValidator.java:109)
> Test-Case:
> --html--
> 	<form jwcid="@Form" delegate="bean:delegate" clientValidationEnabled="ognl:true">	
> 		<input jwcid="@ValidField" type="text" value="ognl:count" validator="bean:requiredString" displayName="testField"/>
> 		<input type="submit" value="Enregistrer"/>
> 	</form>
> --spec--
>     <bean name="requiredString" class="org.apache.tapestry.valid.StringValidator,required,minimumLength=10,clientScriptingEnabled">
>     </bean>
> --java--
> 	public String getMyName() {
> 		System.out.println("get my name " );
> 		return "Numa";
> 	}
> 	
> 	public abstract int getCount();
> 	public abstract void setCount(int count);
> Tested Solution:
> Add the following lines to ValidField.java on line 90 in the method renderComponent
> 		//Add on 4.1, SetScriptSource was added in 4.1 but is never called, so _scriptSource was never initialized
> 		validator.setScriptSource(cycle.getInfrastructure().getScriptSource());
> 		//In case ClientValidationEnabled is set to the form set it also to the Validator
> 		if (getForm().isClientValidationEnabled() && validator instanceof BaseValidator)
> 			((BaseValidator)validator).setClientScriptingEnabled(true);
> I know the component is deprecated, but still in my case I want to migrate from 4.0 to 4.1 and I have more then 50 pages using forms with ValidField, I don't to change all of them, but I would like to take
> the advantage of 4.1 for other pages...
> Regards,
> Numa

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org