Hi Peter,

I see your point. Any class in the pages package can be accessed
through an URL and it doesn't make sense to store anything else than
pages there.

But on the other hand, the behaviour that I reported is totally
obscure and not in line with the nice error reporting of tapestry. If
somebody does put an ASO in the pages package because of ignorance (as
I did) a ClassCastException from a generated method is not likely to
guide to the source of the error. I see two ways to handle this
nicely:
1. When the @ApplicationState annotation is processed report an error
"An ASO cannot be part of the special tapestry packages". This way it
would take 2 minutes to fix the problem instead of 2 hours.
2. In the documentation for the ASO mention that it is not a good
practice to put the ASO in any of tapestry specific packages (pages,
components, ...) but let the people do it if they really want to.

This kind of small thing make quite a difference when starting to work
with a framework like Tapestry where there's a lot going on behind the
scene and as a newcomer you have no ideea that something apparently OK
is not what it seems.

Thanks,

Bogdan.


On 3/22/07, Anjana Gopinath <[EMAIL PROTECTED]> wrote:
I beleive you are supposed to put only your page classes in the page
folder. Refer tapestry 5 tutorial, page 19.





Anjana Gopinath






On Mar 22, 2007, at 10:07 AM, Bogdan Calmac wrote:

> After creating my own ASO object, I kept getting the
> ClassCastExeception below when accessing it, until I had the
> inspiration to move the ASO in a different package than the page. Then
> it worked fine. Is this just a bug or intentional design?
>
> This is the exception (with 5.0.3). The ASO reader throws a
> ClassCastException:
> Caused by: java.lang.ClassCastException:
> org.byteberry.survey.pages.SurveySession
>       at org.byteberry.survey.pages.SurveyDetail2._$read_surveySession
> (SurveyDetail2.java)
>       at org.byteberry.survey.pages.SurveyDetail2.getQuestion0
> (SurveyDetail2.java:55)
>       at $PropertyConduit_11179d07ce4.get
> ($PropertyConduit_11179d07ce4.java)
>       at org.apache.tapestry.internal.bindings.PropBinding.get
> (PropBinding.java:54)
>
> For more details, the ASO is defined with:
>
>  @ApplicationState
>  private SurveySession surveySession;
>
>
> and then accessed in:
>
>  public SurveyQuestion getQuestion0() throws SQLException
>  {
>    return surveySession.questions.get(0);
>  }
>
>
> Thanks,
>
> Bogdan Calmac.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to