From fd9c3e8ea4c7093bff92ec2162ca0be338024fa2 Mon Sep 17 00:00:00 2001 From: jestin Date: Tue, 27 Jul 2004 16:21:38 +0000 Subject: see upstream Changelog and each file's header for detail ... --- src/SelfIvyClient.java | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'src/SelfIvyClient.java') diff --git a/src/SelfIvyClient.java b/src/SelfIvyClient.java index 09d9f80..d6e6f1e 100644 --- a/src/SelfIvyClient.java +++ b/src/SelfIvyClient.java @@ -6,6 +6,8 @@ * @since 1.2.4 * * CHANGELOG: + * 1.2.5: + * - uses apache regexp instead of gnu regexp * 1.2.4: * - adds a the threaded option for callbacks * - Matthieu's bugreport on unBindMsg() @@ -13,7 +15,8 @@ package fr.dgac.ivy ; import java.util.*; -import gnu.regexp.*; +/* import gnu.regexp.*; GNURETOAPACHERE */ +import org.apache.regexp.*; class SelfIvyClient extends IvyClient { @@ -44,7 +47,7 @@ class SelfIvyClient extends IvyClient { callbacks.put(key,callback); threadedFlag.put(key,new Boolean(threaded)); return key.intValue(); - } catch (REException ree) { + } catch (RESyntaxException ree) { throw new IvyException("Invalid regexp " + sregexp); } } @@ -80,11 +83,9 @@ class SelfIvyClient extends IvyClient { Integer key = (Integer)e.nextElement(); RE regexp = (RE)regexps.get(key); String sre = (String)regexpsText.get(key); - int nb = regexp.getNumSubs(); - REMatch result = regexp.getMatch(message); - if (result==null) continue; + if (!regexp.match(message)) continue; count++; - callCallback(this,key,toArgs(nb,result)); + callCallback(this,key,toArgs(regexp)); } return count; } @@ -105,10 +106,10 @@ class SelfIvyClient extends IvyClient { } } - private String[] toArgs(int nb,REMatch result) { - String[] args = new String[nb]; - for(int sub=1;sub<=nb;sub++) { - args[sub-1]=result.toString(sub); + private String[] toArgs(RE re) { + String[] args = new String[re.getParenCount()-1]; + for(int sub=1;sub