aboutsummaryrefslogtreecommitdiff
path: root/src/SelfIvyClient.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/SelfIvyClient.java')
-rw-r--r--src/SelfIvyClient.java21
1 files changed, 11 insertions, 10 deletions
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<re.getParenCount();sub++) {
+ args[sub-1]=re.getParen(sub);
if (bus.doProtectNewlines) args[sub-1]=decode(args[sub-1]);
}
return args;