You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Marius Siegas <ma...@elinara.ktu.lt> on 2004/04/23 09:49:58 UTC

bug? ValidationDelegate throws NullPointerException

Is it a bug or is it me?..

I'm trying to make a component ShowError, its .jwc says:

	<parameter name="delegate" direction="in" 
type="org.apache.tapestry.valid.IValidationDelegate" required="yes"/>
	<component id="ifError" type="Conditional">
		<binding name="condition">delegate.inError</binding>
		<static-binding name="element">div</static-binding>
		<static-binding name="class">errors</static-binding>
	</component>

In its .html there is:

	<div jwcid="ifError">(skip)</div>

The page which is using the component:

	<bean class="org.apache.tapestry.valid.ValidationDelegate" 
name="delegate"/>
	<component id="form" type="Form">
		<binding name="delegate">beans.delegate</binding>
	</component>
	<component id="errors" type="ShowError">
		<binding name="delegate">beans.delegate</binding>
	</component>

After submitting a form on that page I get this:

ognl.OgnlException
inError
java.lang.NullPointerException
Stack Trace:
     * 
org.apache.tapestry.valid.ValidationDelegate.getComponentTracking(ValidationDelegate.java:121)
     * 
org.apache.tapestry.valid.ValidationDelegate.isInError(ValidationDelegate.java:138)
     * sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     * sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
     * sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
     * java.lang.reflect.Method.invoke(Unknown Source)
     * ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:255)
     * ognl.OgnlRuntime.getMethodValue(OgnlRuntime.java:654)
     * 
ognl.ObjectPropertyAccessor.getPossibleProperty(ObjectPropertyAccessor.java:54)
     * 
ognl.ObjectPropertyAccessor.getProperty(ObjectPropertyAccessor.java:122)

I'm using Tapestry 3.0

--
Marius Siegas


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


Re: bug? ValidationDelegate throws NullPointerException

Posted by Marius Siegas <ma...@elinara.ktu.lt>.
yes, that was my mistake, but what about unassociated errors?..

Howard M. Lewis Ship wrote:
> I think you want to invoke ognl:delegate.hasErrors.
> 
> isInError() is for checking if the most recently rendered componenting has any errors and the NPE is
> because, at the start of the form, there is no such component yet.
> 
> It would be better if validation delegate threw an IllegalStateException with a useful message ...
> perhaps you could add a bug?
> 
> --
> Howard M. Lewis Ship
> Independent J2EE / Open-Source Java Consultant
> Creator, Tapestry: Java Web Components 
> Creator, HiveMind
> http://howardlewisship.com


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


RE: bug? ValidationDelegate throws NullPointerException

Posted by "Howard M. Lewis Ship" <hl...@comcast.net>.
I think you want to invoke ognl:delegate.hasErrors.

isInError() is for checking if the most recently rendered componenting has any errors and the NPE is
because, at the start of the form, there is no such component yet.

It would be better if validation delegate threw an IllegalStateException with a useful message ...
perhaps you could add a bug?

--
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Tapestry: Java Web Components 
Creator, HiveMind
http://howardlewisship.com


> -----Original Message-----
> From: Marius Siegas [mailto:marius@elinara.ktu.lt] 
> Sent: Friday, April 23, 2004 3:50 AM
> To: Tapestry users
> Subject: bug? ValidationDelegate throws NullPointerException
> 
> 
> Is it a bug or is it me?..
> 
> I'm trying to make a component ShowError, its .jwc says:
> 
> 	<parameter name="delegate" direction="in" 
> type="org.apache.tapestry.valid.IValidationDelegate" required="yes"/>
> 	<component id="ifError" type="Conditional">
> 		<binding name="condition">delegate.inError</binding>
> 		<static-binding name="element">div</static-binding>
> 		<static-binding name="class">errors</static-binding>
> 	</component>
> 
> In its .html there is:
> 
> 	<div jwcid="ifError">(skip)</div>
> 
> The page which is using the component:
> 
> 	<bean class="org.apache.tapestry.valid.ValidationDelegate" 
> name="delegate"/>
> 	<component id="form" type="Form">
> 		<binding name="delegate">beans.delegate</binding>
> 	</component>
> 	<component id="errors" type="ShowError">
> 		<binding name="delegate">beans.delegate</binding>
> 	</component>
> 
> After submitting a form on that page I get this:
> 
> ognl.OgnlException
> inError
> java.lang.NullPointerException
> Stack Trace:
>      * 
> org.apache.tapestry.valid.ValidationDelegate.getComponentTrack
> ing(ValidationDelegate.java:121)
>      * 
> org.apache.tapestry.valid.ValidationDelegate.isInError(Validat
> ionDelegate.java:138)
>      * sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>      * sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>      * sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>      * java.lang.reflect.Method.invoke(Unknown Source)
>      * ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:255)
>      * ognl.OgnlRuntime.getMethodValue(OgnlRuntime.java:654)
>      * 
> ognl.ObjectPropertyAccessor.getPossibleProperty(ObjectProperty
> Accessor.java:54)
>      * 
> ognl.ObjectPropertyAccessor.getProperty(ObjectPropertyAccessor
> .java:122)
> 
> I'm using Tapestry 3.0
> 
> --
> Marius Siegas
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 


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