blob: 0043c281358ce0ff49baf874305bc0d41f5a190e [file] [log] [blame]
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version
2.0 (the "License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 Unless required by
applicable law or agreed to in writing, software distributed under the
License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the License for
the specific language governing permissions and limitations under the
License.
-->
<test:suite xmlns:j="jelly:core" xmlns:test="jelly:junit"
xmlns:define="jelly:define" xmlns:log="jelly:log">
<test:case name="nested exceptions" xmlns:my="mytaglib">
<define:taglib uri="mytaglib">
<define:tag name="mytag">
<j:scope>
<j:catch var="ex">
<define:invokeBody />
</j:catch>
<log:info>mytag ${name} after catch block exception: ${ex}</log:info>
<j:if test="${ex != null}">
<log:debug>exception was caught !!!</log:debug>
<test:fail>rethrowing the exception</test:fail>
<log:debug>CANNOT REACH THIS POINT !!!</log:debug>
</j:if>
<log:debug>exception was NOT caught !!!</log:debug>
</j:scope>
</define:tag>
</define:taglib>
<j:catch var="checkEx">
<my:mytag name="outer">
<my:mytag name="inner">
<test:fail>boom</test:fail>
</my:mytag>
</my:mytag>
</j:catch>
<j:if test="${checkEx != null}">
<log:info>Outer exception was raised and caught - test passed</log:info>
</j:if>
<j:if test="${checkEx == null}">
<test:fail>Outer exception was not raised - test fails</test:fail>
</j:if>
</test:case>
</test:suite>