cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nicole Erbe <nicole.e...@gmail.com>
Subject Exception handling in sitemap
Date Wed, 01 Jun 2005 11:10:08 GMT
Hi everyone,

I'm trying to handle the following error with an exception selector in
cocoon sitemap.

I get the following error:

Exception in ServerPagesGenerator.generate()

org.apache.cocoon.ProcessingException: Exception in
ServerPagesGenerator.generate(): java.lang.NullPointerException

cause: java.lang.NullPointerException

I get this exception if a request with an invalid date stamp (i.e.
30.02.2004) is passed through a postgresql database and the returned
value is simply "null".
The easiest way might be to show the user of the related application
an error page (i.e. "invalid input values"). So I don't have to change
every concerning xsp and java file (belonging to a system which get's
test data and delivers xml/pdf etc.). This could be done via exception
handling in the cocoon sitemap as far as I got the functionality
right.

In the sitemap I added the following selector:

<map:selectors default="browser">
     <map:selector name="exception"
src="org.apache.cocoon.selection.ExceptionSelector">
            <exception class="java.lang.NullPointerException"
name="invalidInput" />
            <exception class="org.apache.cocoon.ProcessingException"
name="geterror" />
     </map:selector>
</map:selectors>

pipline:

<map:handle-errors>
                            <map:select type="exception">
                                <map:when test="invalidInput">
                                    <map:generate src="notifying"/>
                                    <map:serialize type="xml"/>
                                </map:when>
                                <map:when test="geterror">
                                    <map:generate src="notifying"/>
                                    <map:serialize type="xml"/>
                                </map:when>
                            </map:select>
                        </map:handle-errors>
-------------------------------------------------------------------------------

I know that I have to give the appropriate information to get the
right error page. But the exception handling itself doesn't work. I
still get the cocoon error page "an error occurred" and  not what's
defined in <map:handle-errors>.

Is there anyone who can help me please. Sorry in case I made an
absolute stupid mistake because I'm a cocoon newbie.

Thanks a lot
Nicole

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message