support for CAPTCHAs
[mir.git] / source / tool / ConfigTool.java
index d7e8993..1ead582 100755 (executable)
  */
 package tool;
 
-import gnu.regexp.RE;
-
 import java.security.MessageDigest;
 import java.util.TimeZone;
 
 import mir.util.StringRoutines;
+import org.apache.oro.text.regex.Perl5Compiler;
+import org.apache.oro.text.regex.Pattern;
+import org.apache.oro.text.regex.Perl5Matcher;
+import org.apache.oro.text.regex.PatternMatcher;
 
 /**
  * <p>Title: </p>
@@ -51,12 +53,13 @@ public class ConfigTool {
 
   public static void timezone(String aSpecification) {
     try {
-      RE specification = new RE(aSpecification);
+      PatternMatcher matcher = new Perl5Matcher();
+      Pattern specification = new Perl5Compiler().compile(aSpecification);
       String[] timeZoneIds = TimeZone.getAvailableIDs();
 
       System.out.println("ID\tOffset\tDST?\tName");
       for (int i=0; i<timeZoneIds.length; i++) {
-        if (specification.isMatch(timeZoneIds[i])) {
+        if (matcher.contains(timeZoneIds[i], specification)) {
           TimeZone timeZone = TimeZone.getTimeZone(timeZoneIds[i]);
           long offset = timeZone.getRawOffset()/(1000*60);
           String sign = "";
@@ -86,12 +89,12 @@ public class ConfigTool {
   }
 
   public static void main(String[] anArguments) {
-    String command = "help";
+    String command;
 
     if (anArguments.length >= 1) {
       command = anArguments[0];
 
-      if (command.equals("timezone")) {
+      if ("timezone".equals(command)) {
         if (anArguments.length<=2) {
           if (anArguments.length==2)
             timezone(anArguments[1]);
@@ -101,7 +104,7 @@ public class ConfigTool {
 
         return;
       }
-      else if (command.equals("digest")) {
+      else if ("digest".equals(command)) {
         if (anArguments.length == 3) {
           digest(anArguments[1], anArguments[2]);