<< http://java.net/jira/browse/JAVASERVERFACES-2025 >> This solution ensures that a TagAttributeException will be thrown if the value of the template attribute for the ui:composition / ui:decorate tags references a non existent template - or if the value is the smpty string. SECTION: Modified Files ---------------------------- M jsf-ri/src/main/java/com/sun/faces/facelets/impl/DefaultFaceletCache.java --- Ensure IOException gets propogated so Handlers throw TagAttributeException --- This was necessary as the real IOException is hidden in a thrown FacesException (in DefaultFaceletCache._getLastModified) M jsf-ri/src/main/java/com/sun/faces/facelets/tag/ui/CompositionHandler.java --- Check for empty template value (path) and throw TagAttributeException accordingly M jsf-ri/src/main/java/com/sun/faces/facelets/tag/ui/DecorateHandler.java --- Check for empty template value (path) and throw TagAttributeException accordingly A jsf-test/JAVASERVERFACES-2025 A jsf-test/JAVASERVERFACES-2025/i_jsf_2025 A jsf-test/JAVASERVERFACES-2025/i_jsf_2025/src A jsf-test/JAVASERVERFACES-2025/i_jsf_2025/src/main A jsf-test/JAVASERVERFACES-2025/i_jsf_2025/src/main/java A jsf-test/JAVASERVERFACES-2025/i_jsf_2025/src/main/webapp A jsf-test/JAVASERVERFACES-2025/i_jsf_2025/src/main/webapp/index.decorate.emptypath.xhtml A jsf-test/JAVASERVERFACES-2025/i_jsf_2025/src/main/webapp/index.composition.badpath.xhtml A jsf-test/JAVASERVERFACES-2025/i_jsf_2025/src/main/webapp/WEB-INF A jsf-test/JAVASERVERFACES-2025/i_jsf_2025/src/main/webapp/WEB-INF/faces-config.xml A jsf-test/JAVASERVERFACES-2025/i_jsf_2025/src/main/webapp/WEB-INF/web.xml A jsf-test/JAVASERVERFACES-2025/i_jsf_2025/src/main/webapp/index.decorate.badpath.xhtml A jsf-test/JAVASERVERFACES-2025/i_jsf_2025/src/main/webapp/resources A jsf-test/JAVASERVERFACES-2025/i_jsf_2025/src/main/webapp/index.composition.emptypath.xhtml A jsf-test/JAVASERVERFACES-2025/i_jsf_2025/pom.xml A jsf-test/JAVASERVERFACES-2025/htmlunit A jsf-test/JAVASERVERFACES-2025/htmlunit/src A jsf-test/JAVASERVERFACES-2025/htmlunit/src/main A jsf-test/JAVASERVERFACES-2025/htmlunit/src/main/java A jsf-test/JAVASERVERFACES-2025/htmlunit/src/main/java/com A jsf-test/JAVASERVERFACES-2025/htmlunit/src/main/java/com/sun A jsf-test/JAVASERVERFACES-2025/htmlunit/src/main/java/com/sun/faces A jsf-test/JAVASERVERFACES-2025/htmlunit/src/main/java/com/sun/faces/systest A jsf-test/JAVASERVERFACES-2025/htmlunit/src/main/java/com/sun/faces/systest/Issue2025TestCase.java A jsf-test/JAVASERVERFACES-2025/htmlunit/src/main/resources A jsf-test/JAVASERVERFACES-2025/htmlunit/pom.xml A jsf-test/JAVASERVERFACES-2025/build.xml SECTION: Diffs ---------------------------- Index: jsf-ri/src/main/java/com/sun/faces/facelets/impl/DefaultFaceletCache.java =================================================================== --- jsf-ri/src/main/java/com/sun/faces/facelets/impl/DefaultFaceletCache.java (revision 9024) +++ jsf-ri/src/main/java/com/sun/faces/facelets/impl/DefaultFaceletCache.java (working copy) @@ -159,6 +159,9 @@ if (t instanceof IOException) { throw (IOException)t; } + if (t.getCause() instanceof IOException) { + throw (IOException)t.getCause(); + } if (t instanceof RuntimeException) { throw (RuntimeException)t; } Index: jsf-ri/src/main/java/com/sun/faces/facelets/tag/ui/CompositionHandler.java =================================================================== --- jsf-ri/src/main/java/com/sun/faces/facelets/tag/ui/CompositionHandler.java (revision 9024) +++ jsf-ri/src/main/java/com/sun/faces/facelets/tag/ui/CompositionHandler.java (working copy) @@ -151,7 +151,10 @@ ctx.extendClient(this); String path = null; try { - path = this.template.getValue(ctx); + path = this.template.getValue(ctx); + if (path.length() == 0) { + throw new TagAttributeException(this.tag, this.template, "Invalid path : " + path); + } ctx.includeFacelet(parent, path); } catch (IOException e) { if (log.isLoggable(Level.FINE)) { Index: jsf-ri/src/main/java/com/sun/faces/facelets/tag/ui/DecorateHandler.java =================================================================== --- jsf-ri/src/main/java/com/sun/faces/facelets/tag/ui/DecorateHandler.java (revision 9024) +++ jsf-ri/src/main/java/com/sun/faces/facelets/tag/ui/DecorateHandler.java (working copy) @@ -142,6 +142,9 @@ String path = null; try { path = this.template.getValue(ctx); + if (path.length() == 0) { + throw new TagAttributeException(this.tag, this.template, "Invalid path : " + path); + } ctx.includeFacelet(parent, path); } catch (IOException e) { if (log.isLoggable(Level.FINE)) { Index: jsf-test/JAVASERVERFACES-2025/i_jsf_2025/src/main/webapp/index.decorate.emptypath.xhtml =================================================================== --- jsf-test/JAVASERVERFACES-2025/i_jsf_2025/src/main/webapp/index.decorate.emptypath.xhtml (revision 0) +++ jsf-test/JAVASERVERFACES-2025/i_jsf_2025/src/main/webapp/index.decorate.emptypath.xhtml (revision 0) @@ -0,0 +1,57 @@ + + + + + + + + + + + + + Index: jsf-test/JAVASERVERFACES-2025/i_jsf_2025/src/main/webapp/index.composition.badpath.xhtml =================================================================== --- jsf-test/JAVASERVERFACES-2025/i_jsf_2025/src/main/webapp/index.composition.badpath.xhtml (revision 0) +++ jsf-test/JAVASERVERFACES-2025/i_jsf_2025/src/main/webapp/index.composition.badpath.xhtml (revision 0) @@ -0,0 +1,57 @@ + + + + + + + + + + + + + Index: jsf-test/JAVASERVERFACES-2025/i_jsf_2025/src/main/webapp/WEB-INF/faces-config.xml =================================================================== --- jsf-test/JAVASERVERFACES-2025/i_jsf_2025/src/main/webapp/WEB-INF/faces-config.xml (revision 0) +++ jsf-test/JAVASERVERFACES-2025/i_jsf_2025/src/main/webapp/WEB-INF/faces-config.xml (revision 0) @@ -0,0 +1,50 @@ + + + + + + Index: jsf-test/JAVASERVERFACES-2025/i_jsf_2025/src/main/webapp/WEB-INF/web.xml =================================================================== --- jsf-test/JAVASERVERFACES-2025/i_jsf_2025/src/main/webapp/WEB-INF/web.xml (revision 0) +++ jsf-test/JAVASERVERFACES-2025/i_jsf_2025/src/main/webapp/WEB-INF/web.xml (revision 0) @@ -0,0 +1,61 @@ + + + + + + index.xhtml + + + javax.faces.PROJECT_STAGE + Development + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + *.xhtml + + Index: jsf-test/JAVASERVERFACES-2025/i_jsf_2025/src/main/webapp/index.decorate.badpath.xhtml =================================================================== --- jsf-test/JAVASERVERFACES-2025/i_jsf_2025/src/main/webapp/index.decorate.badpath.xhtml (revision 0) +++ jsf-test/JAVASERVERFACES-2025/i_jsf_2025/src/main/webapp/index.decorate.badpath.xhtml (revision 0) @@ -0,0 +1,57 @@ + + + + + + + + + + + + + Index: jsf-test/JAVASERVERFACES-2025/i_jsf_2025/src/main/webapp/index.composition.emptypath.xhtml =================================================================== --- jsf-test/JAVASERVERFACES-2025/i_jsf_2025/src/main/webapp/index.composition.emptypath.xhtml (revision 0) +++ jsf-test/JAVASERVERFACES-2025/i_jsf_2025/src/main/webapp/index.composition.emptypath.xhtml (revision 0) @@ -0,0 +1,57 @@ + + + + + + + + + + + + + Index: jsf-test/JAVASERVERFACES-2025/i_jsf_2025/pom.xml =================================================================== --- jsf-test/JAVASERVERFACES-2025/i_jsf_2025/pom.xml (revision 0) +++ jsf-test/JAVASERVERFACES-2025/i_jsf_2025/pom.xml (revision 0) @@ -0,0 +1,117 @@ + + + + + 4.0.0 + + com.sun.faces.regression + i_jsf_2025 + 1.0 + war + + i_jsf_2025 + + + maven-compiler-plugin + + 1.6 + 1.6 + + + + maven-dependency-plugin + + + install + + + + + + + + + + + org.jvnet.wagon-svn + wagon-svn + 1.12 + + + + + + javax.faces + jsf-api + 2.1 + provided + + + javax + javaee-api + 6.0 + provided + + + + + + + false + java.net-maven2-repository + java-net:/maven2-repository~svn/trunk/repository/ + + + + + + java.net + java.net + http://download.java.net/maven/2 + default + + + + + Index: jsf-test/JAVASERVERFACES-2025/htmlunit/src/main/java/com/sun/faces/systest/Issue2025TestCase.java =================================================================== --- jsf-test/JAVASERVERFACES-2025/htmlunit/src/main/java/com/sun/faces/systest/Issue2025TestCase.java (revision 0) +++ jsf-test/JAVASERVERFACES-2025/htmlunit/src/main/java/com/sun/faces/systest/Issue2025TestCase.java (revision 0) @@ -0,0 +1,117 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 1997-2011 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + */ + +package com.sun.faces.systest; + +import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException; +import com.gargoylesoftware.htmlunit.html.HtmlAnchor; +import com.gargoylesoftware.htmlunit.html.HtmlPage; + +import com.sun.faces.htmlunit.HtmlUnitFacesTestCase; +import java.util.ArrayList; +import java.util.List; +import junit.framework.Test; +import junit.framework.TestSuite; + + +public class Issue2025TestCase extends HtmlUnitFacesTestCase { + + public Issue2025TestCase(String name) { + super(name); + } + + /** + * Set up instance variables required by this test case. + */ + public void setUp() throws Exception { + super.setUp(); + } + + + /** + * Return the tests included in this test suite. + */ + public static Test suite() { + return (new TestSuite(Issue2025TestCase.class)); + } + + + /** + * Tear down instance variables required by this test case. + */ + public void tearDown() { + super.tearDown(); + } + + + // ------------------------------------------------------------ Test Methods + + public void testBasicAppFunctionality() throws Exception { + + HtmlPage page = null; + + try { + page = getPage("/index.composite.badpath.xhtml"); + } catch (FailingHttpStatusCodeException e) { + assertTrue(e.getResponse().getContentAsString().contains("Invalid path : foobar")); + } + + try { + page = getPage("/index.composite.emptypath.xhtml"); + } catch (FailingHttpStatusCodeException e) { + assertTrue(e.getResponse().getContentAsString().contains("Invalid path :")); + } + + try { + page = getPage("/index.decorate.badpath.xhtml"); + } catch (FailingHttpStatusCodeException e) { + assertTrue(e.getResponse().getContentAsString().contains("Invalid path : foobar")); + } + + try { + page = getPage("/index.decorate.emptypath.xhtml"); + } catch (FailingHttpStatusCodeException e) { + assertTrue(e.getResponse().getContentAsString().contains("Invalid path :")); + } + } + + + +} Index: jsf-test/JAVASERVERFACES-2025/htmlunit/pom.xml =================================================================== --- jsf-test/JAVASERVERFACES-2025/htmlunit/pom.xml (revision 0) +++ jsf-test/JAVASERVERFACES-2025/htmlunit/pom.xml (revision 0) @@ -0,0 +1,114 @@ + + + + + 4.0.0 + com.sun.faces.test + i_jsf_2025_htmlunit + jar + i_jsf_2025_htmlunit + 2.0 + + + + + + + + + + + htmlunit + net.sourceforge.htmlunit + 2.4 + provided + + + junit + junit + 3.8.1 + provided + + + com.sun.faces.extensions + jsf-extensions-test-time + 2.0 + provided + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.0.2 + + 1.6 + 1.6 + + + + maven-war-plugin + org.apache.maven.plugins + 2.1-alpha-2 + + false + + + + + i_jsf_2025_htmlunit + + + + + java.net + java.net + http://download.java.net/maven/2 + default + + + + Index: jsf-test/JAVASERVERFACES-2025/build.xml =================================================================== --- jsf-test/JAVASERVERFACES-2025/build.xml (revision 0) +++ jsf-test/JAVASERVERFACES-2025/build.xml (revision 0) @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SECTION: New Files ---------------------------- SEE ATTACHMENTS