Return-Path: Delivered-To: apmail-struts-commits-archive@minotaur.apache.org Received: (qmail 51936 invoked from network); 30 Sep 2009 17:29:30 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 30 Sep 2009 17:29:30 -0000 Received: (qmail 87131 invoked by uid 500); 30 Sep 2009 17:29:30 -0000 Delivered-To: apmail-struts-commits-archive@struts.apache.org Received: (qmail 87074 invoked by uid 500); 30 Sep 2009 17:29:29 -0000 Mailing-List: contact commits-help@struts.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@struts.apache.org Delivered-To: mailing list commits@struts.apache.org Received: (qmail 87065 invoked by uid 99); 30 Sep 2009 17:29:29 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 30 Sep 2009 17:29:29 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 30 Sep 2009 17:29:28 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 206F42388908; Wed, 30 Sep 2009 17:29:08 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r820353 - in /struts/struts2/trunk/plugins/convention/src: main/java/org/apache/struts2/convention/DefaultResultMapBuilder.java test/java/org/apache/struts2/convention/DefaultResultMapBuilderTest.java test/resources/WEB-INF/component/.boom Date: Wed, 30 Sep 2009 17:29:07 -0000 To: commits@struts.apache.org From: musachy@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090930172908.206F42388908@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: musachy Date: Wed Sep 30 17:29:07 2009 New Revision: 820353 URL: http://svn.apache.org/viewvc?rev=820353&view=rev Log: Ignore potential results that start with "." Added: struts/struts2/trunk/plugins/convention/src/test/resources/WEB-INF/component/.boom Modified: struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/DefaultResultMapBuilder.java struts/struts2/trunk/plugins/convention/src/test/java/org/apache/struts2/convention/DefaultResultMapBuilderTest.java Modified: struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/DefaultResultMapBuilder.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/DefaultResultMapBuilder.java?rev=820353&r1=820352&r2=820353&view=diff ============================================================================== --- struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/DefaultResultMapBuilder.java (original) +++ struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/DefaultResultMapBuilder.java Wed Sep 30 17:29:07 2009 @@ -258,6 +258,13 @@ LOG.trace("Processing resource path [#0]", path); } + String fileName = StringUtils.substringAfterLast(path, "/"); + if (StringUtils.startsWith(fileName, ".")) { + if (LOG.isTraceEnabled()) + LOG.trace("Ignoring file without name [#0]", path); + continue; + } + makeResults(actionClass, path, resultPrefix, results, packageConfig, resultsByExtension); } } Modified: struts/struts2/trunk/plugins/convention/src/test/java/org/apache/struts2/convention/DefaultResultMapBuilderTest.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/convention/src/test/java/org/apache/struts2/convention/DefaultResultMapBuilderTest.java?rev=820353&r1=820352&r2=820353&view=diff ============================================================================== --- struts/struts2/trunk/plugins/convention/src/test/java/org/apache/struts2/convention/DefaultResultMapBuilderTest.java (original) +++ struts/struts2/trunk/plugins/convention/src/test/java/org/apache/struts2/convention/DefaultResultMapBuilderTest.java Wed Sep 30 17:29:07 2009 @@ -148,6 +148,30 @@ } + public void testIgnoreFilesWithoutName() throws Exception { + ServletContext context = EasyMock.createStrictMock(ServletContext.class); + + // Setup some mock jsps + Set resources = new HashSet(); + resources.add("/WEB-INF/location/namespace/no-annotation/.svn"); + resources.add("/WEB-INF/location/namespace/no-annotation-success.jsp"); + EasyMock.expect(context.getResourcePaths("/WEB-INF/location/namespace/")).andReturn(resources); + EasyMock.replay(context); + + PackageConfig packageConfig = createPackageConfigBuilder("/namespace"); + + this.conventionsService = new ConventionsServiceImpl("/WEB-INF/location"); + DefaultResultMapBuilder builder = new DefaultResultMapBuilder(context, container, "dispatcher,velocity,freemarker"); + Map results = builder.build(NoAnnotationAction.class, null, "no-annotation", packageConfig); + assertEquals(1, results.size()); + assertEquals("success", results.get("success").getName()); + assertEquals(3, results.get("success").getParams().size()); + assertEquals("org.apache.struts2.dispatcher.ServletDispatcherResult", results.get("success").getClassName()); + assertEquals("/WEB-INF/location/namespace/no-annotation-success.jsp", results.get("success").getParams().get("location")); + EasyMock.verify(context); + + } + public void testClassLevelSingleResultAnnotation() throws Exception { ServletContext context = EasyMock.createStrictMock(ServletContext.class); Added: struts/struts2/trunk/plugins/convention/src/test/resources/WEB-INF/component/.boom URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/convention/src/test/resources/WEB-INF/component/.boom?rev=820353&view=auto ============================================================================== (empty)