Author: rwinston Date: Sat Jan 28 10:31:11 2006 New Revision: 373207 URL: http://svn.apache.org/viewcvs?rev=373207&view=rev Log: Changed to JD 1.4 regex package
Modified: jakarta/commons/proper/net/branches/JDK_1_4_BRANCH/src/java/org/apache/commons/net/ftp/parser/RegexFTPFileEntryParserImpl.java Modified: jakarta/commons/proper/net/branches/JDK_1_4_BRANCH/src/java/org/apache/commons/net/ftp/parser/RegexFTPFileEntryParserImpl.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/net/branches/JDK_1_4_BRANCH/src/java/org/apache/commons/net/ftp/parser/RegexFTPFileEntryParserImpl.java?rev=373207&r1=373206&r2=373207&view=diff ============================================================================== --- jakarta/commons/proper/net/branches/JDK_1_4_BRANCH/src/java/org/apache/commons/net/ftp/parser/RegexFTPFileEntryParserImpl.java (original) +++ jakarta/commons/proper/net/branches/JDK_1_4_BRANCH/src/java/org/apache/commons/net/ftp/parser/RegexFTPFileEntryParserImpl.java Sat Jan 28 10:31:11 2006 @@ -15,13 +15,12 @@ */ package org.apache.commons.net.ftp.parser; +import java.util.regex.MatchResult; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.regex.PatternSyntaxException; + import org.apache.commons.net.ftp.FTPFileEntryParserImpl; -import org.apache.oro.text.regex.MalformedPatternException; -import org.apache.oro.text.regex.MatchResult; -import org.apache.oro.text.regex.Pattern; -import org.apache.oro.text.regex.PatternMatcher; -import org.apache.oro.text.regex.Perl5Compiler; -import org.apache.oro.text.regex.Perl5Matcher; @@ -51,7 +50,7 @@ * Internal PatternMatcher object used by the parser. It has protected * scope in case subclasses want to make use of it for their own purposes. */ - protected PatternMatcher _matcher_ = null; + protected Matcher _matcher_ = null; /** * The constructor for a RegexFTPFileEntryParserImpl object. @@ -72,10 +71,10 @@ super(); try { - _matcher_ = new Perl5Matcher(); - pattern = new Perl5Compiler().compile(regex); + //_matcher_ = new Perl5Matcher(); + pattern = Pattern.compile(regex); } - catch (MalformedPatternException e) + catch (PatternSyntaxException pse) { throw new IllegalArgumentException ( "Unparseable regex supplied: " + regex); @@ -93,9 +92,10 @@ public boolean matches(String s) { this.result = null; - if (_matcher_.matches(s.trim(), this.pattern)) + _matcher_ = pattern.matcher(s); + if (_matcher_.matches()) { - this.result = _matcher_.getMatch(); + this.result = _matcher_.toMatchResult(); } return null != this.result; } @@ -115,7 +115,7 @@ { return 0; } - return this.result.groups(); + return this.result.groupCount(); } @@ -149,7 +149,7 @@ public String getGroupsAsString() { StringBuffer b = new StringBuffer(); - for (int i = 1; i <= this.result.groups(); i++) + for (int i = 1; i <= this.result.groupCount(); i++) { b.append(i).append(") ").append(this.result.group(i)) .append(System.getProperty("line.separator")); --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]