Return-Path: X-Original-To: apmail-cocoon-cvs-archive@www.apache.org Delivered-To: apmail-cocoon-cvs-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 26DB89D24 for ; Mon, 21 May 2012 08:31:54 +0000 (UTC) Received: (qmail 41820 invoked by uid 500); 21 May 2012 08:31:53 -0000 Delivered-To: apmail-cocoon-cvs-archive@cocoon.apache.org Received: (qmail 41749 invoked by uid 500); 21 May 2012 08:31:53 -0000 Mailing-List: contact cvs-help@cocoon.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@cocoon.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list cvs@cocoon.apache.org Received: (qmail 41731 invoked by uid 99); 21 May 2012 08:31:52 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 May 2012 08:31:52 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.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; Mon, 21 May 2012 08:31:51 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 4A1E72388860 for ; Mon, 21 May 2012 08:31:31 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1340929 - /cocoon/cocoon3/trunk/cocoon-optional/src/main/java/org/apache/cocoon/optional/pipeline/components/sax/directory/DirectoryGenerator.java Date: Mon, 21 May 2012 08:31:31 -0000 To: cvs@cocoon.apache.org From: ilgrosso@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120521083131.4A1E72388860@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: ilgrosso Date: Mon May 21 08:31:30 2012 New Revision: 1340929 URL: http://svn.apache.org/viewvc?rev=1340929&view=rev Log: [COCOON3-76] Applying provided patch Modified: cocoon/cocoon3/trunk/cocoon-optional/src/main/java/org/apache/cocoon/optional/pipeline/components/sax/directory/DirectoryGenerator.java Modified: cocoon/cocoon3/trunk/cocoon-optional/src/main/java/org/apache/cocoon/optional/pipeline/components/sax/directory/DirectoryGenerator.java URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-optional/src/main/java/org/apache/cocoon/optional/pipeline/components/sax/directory/DirectoryGenerator.java?rev=1340929&r1=1340928&r2=1340929&view=diff ============================================================================== --- cocoon/cocoon3/trunk/cocoon-optional/src/main/java/org/apache/cocoon/optional/pipeline/components/sax/directory/DirectoryGenerator.java (original) +++ cocoon/cocoon3/trunk/cocoon-optional/src/main/java/org/apache/cocoon/optional/pipeline/components/sax/directory/DirectoryGenerator.java Mon May 21 08:31:30 2012 @@ -27,6 +27,8 @@ import java.util.Date; import java.util.List; import java.util.Map; import java.util.Stack; +import java.util.regex.Pattern; +import java.util.regex.PatternSyntaxException; import org.apache.cocoon.pipeline.ProcessingException; import org.apache.cocoon.pipeline.SetupException; @@ -36,8 +38,6 @@ import org.apache.cocoon.pipeline.cachin import org.apache.cocoon.pipeline.component.CachingPipelineComponent; import org.apache.cocoon.pipeline.components.parameters.Parameters; import org.apache.cocoon.sax.AbstractSAXGenerator; -import org.apache.regexp.RE; -import org.apache.regexp.RESyntaxException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.xml.sax.SAXException; @@ -105,13 +105,13 @@ public class DirectoryGenerator extends protected boolean reverse; /** The regular expression for the root pattern. */ - protected RE rootRE; + protected Pattern rootRE; /** The regular expression for the include pattern. */ - protected RE includeRE; + protected Pattern includeRE; /** The regular expression for the exclude pattern. */ - protected RE excludeRE; + protected Pattern excludeRE; /** * This is only set to true for the requested directory specified by the @@ -175,23 +175,23 @@ public class DirectoryGenerator extends String rePattern = null; try { rePattern = parameters.get("root", null); - this.rootRE = (rePattern == null) ? null : new RE(rePattern); + this.rootRE = (rePattern == null) ? null : Pattern.compile(rePattern); if (LOG.isDebugEnabled()) { LOG.debug("root pattern: " + rePattern); } rePattern = parameters.get("include", null); - this.includeRE = (rePattern == null) ? null : new RE(rePattern); + this.includeRE = (rePattern == null) ? null : Pattern.compile(rePattern); if (LOG.isDebugEnabled()) { LOG.debug("include pattern: " + rePattern); } rePattern = parameters.get("exclude", null); - this.excludeRE = (rePattern == null) ? null : new RE(rePattern); + this.excludeRE = (rePattern == null) ? null : Pattern.compile(rePattern); if (LOG.isDebugEnabled()) { LOG.debug("exclude pattern: " + rePattern); } - } catch (RESyntaxException rese) { + } catch (PatternSyntaxException rese) { throw new ProcessingException("Syntax error in regexp pattern '" + rePattern + "'", rese); } @@ -433,7 +433,7 @@ public class DirectoryGenerator extends * @return true if the File is the root or the root pattern is not set, false otherwise. */ protected boolean isRoot(final File path) { - return this.rootRE == null || this.rootRE.match(path.getName()); + return this.rootRE == null || this.rootRE.matcher(path.getName()).matches(); } /** @@ -443,7 +443,7 @@ public class DirectoryGenerator extends * @return true if the File shall be visible or the include Pattern is null, false otherwise. */ protected boolean isIncluded(final File path) { - return this.includeRE == null || this.includeRE.match(path.getName()); + return this.includeRE == null || this.includeRE.matcher(path.getName()).matches(); } /** @@ -454,7 +454,7 @@ public class DirectoryGenerator extends * otherwise. */ protected boolean isExcluded(final File path) { - return this.excludeRE != null && this.excludeRE.match(path.getName()); + return this.excludeRE != null && this.excludeRE.matcher(path.getName()).matches(); } @Override