From 14c5f3996a46c1281cb133de439f25492c97530a Mon Sep 17 00:00:00 2001
From: dugan <dugan@localhost>
Date: Wed, 07 Mar 2007 14:56:34 +0000
Subject: [PATCH] These changes are mostly related to restructuring the regular expression patterns to make them more readable by defining constants. 

---
 opends/src/server/org/opends/server/authorization/dseecompat/IpCriteria.java |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/opends/src/server/org/opends/server/authorization/dseecompat/IpCriteria.java b/opends/src/server/org/opends/server/authorization/dseecompat/IpCriteria.java
index a81048b..19199b0 100644
--- a/opends/src/server/org/opends/server/authorization/dseecompat/IpCriteria.java
+++ b/opends/src/server/org/opends/server/authorization/dseecompat/IpCriteria.java
@@ -28,6 +28,7 @@
 package org.opends.server.authorization.dseecompat;
 
 import static org.opends.server.authorization.dseecompat.AciMessages.*;
+import static org.opends.server.authorization.dseecompat.Aci.*;
 import static org.opends.server.messages.MessageHandler.getMessage;
 import java.net.Inet6Address;
 import java.net.InetAddress;
@@ -39,8 +40,7 @@
 /**
  * This class represents a ip bind rule keyword.
  */
-public class IpCriteria implements KeywordBindRule
-{
+public class IpCriteria implements KeywordBindRule {
     private EnumBindRuleType type=null;
 
     // private token to express that any address is accepted
@@ -50,6 +50,13 @@
     private IpBitsNetworkCriteria[] ipBitsCriteria = null;
     private IpMaskNetworkCriteria[] ipMaskCriteria = null;
 
+    private static final String valueRegex =
+                                   "([^," + ZERO_OR_MORE_WHITESPACE + "]+)";
+
+    private static final String valuesRegex =
+            valueRegex + ZERO_OR_MORE_WHITESPACE + "(," +
+            ZERO_OR_MORE_WHITESPACE + valueRegex + ")*";
+
     /*
      * TODO Verifiy IpCriteria constructor adheres to DS 5.2 ip keyword
      * syntax.
@@ -245,8 +252,6 @@
      */
     public static KeywordBindRule decode(String expr, EnumBindRuleType type)
     throws AciException  {
-        String valueRegex = "([^,\\s]+)";
-        String valuesRegex = valueRegex + "\\s*(,\\s*" + valueRegex + ")*";
         if (!Pattern.matches(valuesRegex, expr)) {
             int msgID = MSGID_ACI_SYNTAX_INVALID_IP_EXPRESSION;
             String message = getMessage(msgID, expr);

--
Gitblit v1.10.0