You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by il...@apache.org on 2012/05/21 10:31:31 UTC
svn commit: r1340929 -
/cocoon/cocoon3/trunk/cocoon-optional/src/main/java/org/apache/cocoon/optional/pipeline/components/sax/directory/DirectoryGenerator.java
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 <code>null</code>, 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
Re: svn commit: r1340929 - /cocoon/cocoon3/trunk/cocoon-optional/src/main/java/org/apache/cocoon/optional/pipeline/components/sax/directory/DirectoryGenerator.java
Posted by Stavros Kounis <sk...@gmail.com>.
unsubscribe
On 21 May 2012 11:31, <il...@apache.org> wrote:
> 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
> <code>null</code>, 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
>
>
>
--
Stavros S. Kounis
e: skounis@urbantech.gr
b: http://skounis.blogspot.com
////// Urban Technologies
Venizelou 70
67100 Xanthi
Greece
t: +30 25410 83370
f: +30 25410 83007
e: info@urbantech.gr
w: http://www.urbantech.gr
////// Social
linkstream: http://skounis.tumblr.com/
<http://skounis.tumblr.com/>photostream:
http://www.flickr.com/photos/skounis/
tweets: http://twitter.com/#!/skounis