activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r563982 [4/32] - in /activemq/trunk/activemq-core/src: main/java/org/apache/activemq/ main/java/org/apache/activemq/advisory/ main/java/org/apache/activemq/blob/ main/java/org/apache/activemq/broker/ main/java/org/apache/activemq/broker/jmx...
Date Wed, 08 Aug 2007 18:58:13 GMT
Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/TransactionInfo.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/TransactionInfo.java?view=diff&rev=563982&r1=563981&r2=563982
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/TransactionInfo.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/TransactionInfo.java Wed Aug  8 11:56:59 2007
@@ -27,29 +27,28 @@
  */
 public class TransactionInfo extends BaseCommand {
 
-    public static final byte DATA_STRUCTURE_TYPE=CommandTypes.TRANSACTION_INFO;
-
+    public static final byte DATA_STRUCTURE_TYPE = CommandTypes.TRANSACTION_INFO;
 
     public static final byte BEGIN = 0;
-    public static final byte PREPARE=1; 
-    public static final byte COMMIT_ONE_PHASE=2; 
-    public static final byte COMMIT_TWO_PHASE=3; 
-    public static final byte ROLLBACK=4; 
-    public static final byte RECOVER=5; 
-    public static final byte FORGET=6; 
-    public static final byte END=7; 
-    
+    public static final byte PREPARE = 1;
+    public static final byte COMMIT_ONE_PHASE = 2;
+    public static final byte COMMIT_TWO_PHASE = 3;
+    public static final byte ROLLBACK = 4;
+    public static final byte RECOVER = 5;
+    public static final byte FORGET = 6;
+    public static final byte END = 7;
+
     protected byte type;
     protected ConnectionId connectionId;
     protected TransactionId transactionId;
-    
-    public TransactionInfo() {        
+
+    public TransactionInfo() {
     }
-    
+
     public TransactionInfo(ConnectionId connectionId, TransactionId transactionId, byte type) {
-        this.connectionId=connectionId;
-        this.transactionId=transactionId;
-        this.type=type;
+        this.connectionId = connectionId;
+        this.transactionId = transactionId;
+        this.type = type;
     }
 
     public byte getDataStructureType() {
@@ -58,20 +57,22 @@
 
     /**
      * @openwire:property version=1 cache=true
-     */    
+     */
     public ConnectionId getConnectionId() {
         return connectionId;
     }
+
     public void setConnectionId(ConnectionId connectionId) {
         this.connectionId = connectionId;
     }
 
     /**
      * @openwire:property version=1 cache=true
-     */    
+     */
     public TransactionId getTransactionId() {
         return transactionId;
-    }    
+    }
+
     public void setTransactionId(TransactionId transactionId) {
         this.transactionId = transactionId;
     }
@@ -81,13 +82,14 @@
      */
     public byte getType() {
         return type;
-    }    
+    }
+
     public void setType(byte type) {
         this.type = type;
     }
 
     public Response visit(CommandVisitor visitor) throws Exception {
-        switch( type ) {
+        switch (type) {
         case TransactionInfo.BEGIN:
             return visitor.processBeginTransaction(this);
         case TransactionInfo.END:
@@ -105,7 +107,7 @@
         case TransactionInfo.FORGET:
             return visitor.processForgetTransaction(this);
         default:
-            throw new IOException("Transaction info type unknown: "+type);
+            throw new IOException("Transaction info type unknown: " + type);
         }
     }
 

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/WireFormatInfo.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/WireFormatInfo.java?view=diff&rev=563982&r1=563981&r2=563982
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/WireFormatInfo.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/WireFormatInfo.java Wed Aug  8 11:56:59 2007
@@ -38,14 +38,14 @@
  */
 public class WireFormatInfo implements Command, MarshallAware {
 
-    private static final int MAX_PROPERTY_SIZE = 1024*4;
-	public static final byte DATA_STRUCTURE_TYPE = CommandTypes.WIREFORMAT_INFO;
-    static final private byte MAGIC[] = new byte[] { 'A', 'c', 't', 'i', 'v', 'e', 'M', 'Q' };
+    private static final int MAX_PROPERTY_SIZE = 1024 * 4;
+    public static final byte DATA_STRUCTURE_TYPE = CommandTypes.WIREFORMAT_INFO;
+    static final private byte MAGIC[] = new byte[] {'A', 'c', 't', 'i', 'v', 'e', 'M', 'Q'};
 
     protected byte magic[] = MAGIC;
     protected int version;
     protected ByteSequence marshalledProperties;
-    
+
     protected transient Map properties;
     private transient Endpoint from;
     private transient Endpoint to;
@@ -68,6 +68,7 @@
     public byte[] getMagic() {
         return magic;
     }
+
     public void setMagic(byte[] magic) {
         this.magic = magic;
     }
@@ -78,16 +79,18 @@
     public int getVersion() {
         return version;
     }
+
     public void setVersion(int version) {
         this.version = version;
     }
-    
+
     /**
      * @openwire:property version=1
      */
     public ByteSequence getMarshalledProperties() {
         return marshalledProperties;
     }
+
     public void setMarshalledProperties(ByteSequence marshalledProperties) {
         this.marshalledProperties = marshalledProperties;
     }
@@ -104,7 +107,8 @@
     }
 
     /**
-     * The endpoint within the transport where this message is going to - null means all endpoints.
+     * The endpoint within the transport where this message is going to - null
+     * means all endpoints.
      */
     public Endpoint getTo() {
         return to;
@@ -113,34 +117,34 @@
     public void setTo(Endpoint to) {
         this.to = to;
     }
-    
-    //////////////////////
+
+    // ////////////////////
     // 
     // Implementation Methods.
     //
-    //////////////////////
-    
+    // ////////////////////
+
     public Object getProperty(String name) throws IOException {
-        if( properties == null ) {
-            if( marshalledProperties ==null )
+        if (properties == null) {
+            if (marshalledProperties == null)
                 return null;
             properties = unmarsallProperties(marshalledProperties);
         }
         return properties.get(name);
     }
-    
+
     public Map getProperties() throws IOException {
-        if( properties == null ) {
-            if( marshalledProperties==null )
+        if (properties == null) {
+            if (marshalledProperties == null)
                 return Collections.EMPTY_MAP;
             properties = unmarsallProperties(marshalledProperties);
         }
         return Collections.unmodifiableMap(properties);
     }
-    
+
     public void clearProperties() {
         marshalledProperties = null;
-        properties=null;
+        properties = null;
     }
 
     public void setProperty(String name, Object value) throws IOException {
@@ -149,8 +153,8 @@
     }
 
     protected void lazyCreateProperties() throws IOException {
-        if( properties == null ) {
-            if( marshalledProperties == null ) {
+        if (properties == null) {
+            if (marshalledProperties == null) {
                 properties = new HashMap();
             } else {
                 properties = unmarsallProperties(marshalledProperties);
@@ -158,14 +162,16 @@
             }
         }
     }
-    
+
     private Map unmarsallProperties(ByteSequence marshalledProperties) throws IOException {
-        return MarshallingSupport.unmarshalPrimitiveMap(new DataInputStream(new ByteArrayInputStream(marshalledProperties)), MAX_PROPERTY_SIZE);
+        return MarshallingSupport
+            .unmarshalPrimitiveMap(new DataInputStream(new ByteArrayInputStream(marshalledProperties)),
+                                   MAX_PROPERTY_SIZE);
     }
 
     public void beforeMarshall(WireFormat wireFormat) throws IOException {
         // Need to marshal the properties.
-        if( marshalledProperties==null && properties!=null ) {
+        if (marshalledProperties == null && properties != null) {
             ByteArrayOutputStream baos = new ByteArrayOutputStream();
             DataOutputStream os = new DataOutputStream(baos);
             MarshallingSupport.marshalPrimitiveMap(properties, os);
@@ -183,7 +189,6 @@
     public void afterUnmarshall(WireFormat wireFormat) throws IOException {
     }
 
-
     public boolean isValid() {
         return magic != null && Arrays.equals(magic, MAGIC);
     }
@@ -192,141 +197,159 @@
     }
 
     /**
-     * @throws IOException 
+     * @throws IOException
      */
     public boolean isCacheEnabled() throws IOException {
         return Boolean.TRUE == getProperty("CacheEnabled");
     }
+
     public void setCacheEnabled(boolean cacheEnabled) throws IOException {
         setProperty("CacheEnabled", cacheEnabled ? Boolean.TRUE : Boolean.FALSE);
     }
 
     /**
-     * @throws IOException 
+     * @throws IOException
      */
     public boolean isStackTraceEnabled() throws IOException {
         return Boolean.TRUE == getProperty("StackTraceEnabled");
     }
+
     public void setStackTraceEnabled(boolean stackTraceEnabled) throws IOException {
         setProperty("StackTraceEnabled", stackTraceEnabled ? Boolean.TRUE : Boolean.FALSE);
     }
 
     /**
-     * @throws IOException 
+     * @throws IOException
      */
     public boolean isTcpNoDelayEnabled() throws IOException {
         return Boolean.TRUE == getProperty("TcpNoDelayEnabled");
     }
+
     public void setTcpNoDelayEnabled(boolean tcpNoDelayEnabled) throws IOException {
         setProperty("TcpNoDelayEnabled", tcpNoDelayEnabled ? Boolean.TRUE : Boolean.FALSE);
     }
 
     /**
-     * @throws IOException 
+     * @throws IOException
      */
     public boolean isSizePrefixDisabled() throws IOException {
         return Boolean.TRUE == getProperty("SizePrefixDisabled");
     }
+
     public void setSizePrefixDisabled(boolean prefixPacketSize) throws IOException {
         setProperty("SizePrefixDisabled", prefixPacketSize ? Boolean.TRUE : Boolean.FALSE);
     }
 
     /**
-     * @throws IOException 
+     * @throws IOException
      */
     public boolean isTightEncodingEnabled() throws IOException {
         return Boolean.TRUE == getProperty("TightEncodingEnabled");
     }
+
     public void setTightEncodingEnabled(boolean tightEncodingEnabled) throws IOException {
         setProperty("TightEncodingEnabled", tightEncodingEnabled ? Boolean.TRUE : Boolean.FALSE);
     }
-    
+
     /**
-     * @throws IOException 
+     * @throws IOException
      */
     public long getMaxInactivityDuration() throws IOException {
-        Long l = (Long) getProperty("MaxInactivityDuration");
+        Long l = (Long)getProperty("MaxInactivityDuration");
         return l == null ? 0 : l.longValue();
     }
+
     public void seMaxInactivityDuration(long maxInactivityDuration) throws IOException {
         setProperty("MaxInactivityDuration", new Long(maxInactivityDuration));
     }
 
     /**
-     * @throws IOException 
+     * @throws IOException
      */
     public int getCacheSize() throws IOException {
-        Integer i = (Integer) getProperty("CacheSize");
+        Integer i = (Integer)getProperty("CacheSize");
         return i == null ? 0 : i.intValue();
     }
+
     public void setCacheSize(int cacheSize) throws IOException {
         setProperty("CacheSize", new Integer(cacheSize));
     }
-    
-    
+
     public Response visit(CommandVisitor visitor) throws Exception {
         return visitor.processWireFormat(this);
     }
 
     public String toString() {
-    	Map p=null;
-		try {
-			p = getProperties();
-		} catch (IOException e) {
-		}
-        return "WireFormatInfo { version="+version+", properties="+p+", magic="+toString(magic)+"}";
+        Map p = null;
+        try {
+            p = getProperties();
+        } catch (IOException e) {
+        }
+        return "WireFormatInfo { version=" + version + ", properties=" + p + ", magic=" + toString(magic)
+               + "}";
     }
-    
-    private String toString(byte []data) {
+
+    private String toString(byte[] data) {
         StringBuffer sb = new StringBuffer();
         sb.append('[');
         for (int i = 0; i < data.length; i++) {
-            if( i != 0 ) {
+            if (i != 0) {
                 sb.append(',');
             }
-            sb.append((char)data[i]);            
+            sb.append((char)data[i]);
         }
         sb.append(']');
         return sb.toString();
     }
 
-    ///////////////////////////////////////////////////////////////
+    // /////////////////////////////////////////////////////////////
     //
     // This are not implemented.
     //
-    ///////////////////////////////////////////////////////////////
-    
+    // /////////////////////////////////////////////////////////////
+
     public void setCommandId(int value) {
     }
+
     public int getCommandId() {
         return 0;
     }
+
     public boolean isResponseRequired() {
         return false;
     }
+
     public boolean isResponse() {
         return false;
     }
+
     public boolean isBrokerInfo() {
         return false;
     }
+
     public boolean isMessageDispatch() {
         return false;
     }
+
     public boolean isMessage() {
         return false;
     }
+
     public boolean isMessageAck() {
         return false;
     }
-    public boolean isMessageDispatchNotification(){
+
+    public boolean isMessageDispatchNotification() {
         return false;
     }
-    public boolean isShutdownInfo(){
+
+    public boolean isShutdownInfo() {
         return false;
     }
+
     public void setCachedMarshalledForm(WireFormat wireFormat, ByteSequence data) {
     }
+
     public ByteSequence getCachedMarshalledForm(WireFormat wireFormat) {
         return null;
     }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/XATransactionId.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/XATransactionId.java?view=diff&rev=563982&r1=563981&r2=563982
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/XATransactionId.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/XATransactionId.java Wed Aug  8 11:56:59 2007
@@ -20,39 +20,38 @@
 import javax.transaction.xa.Xid;
 import org.apache.activemq.util.HexSupport;
 
-
 /**
  * @openwire:marshaller code="112"
  * @version $Revision: 1.6 $
  */
-public class XATransactionId extends TransactionId implements Xid, Comparable{
-    
-    public static final byte DATA_STRUCTURE_TYPE=CommandTypes.ACTIVEMQ_XA_TRANSACTION_ID;
+public class XATransactionId extends TransactionId implements Xid, Comparable {
+
+    public static final byte DATA_STRUCTURE_TYPE = CommandTypes.ACTIVEMQ_XA_TRANSACTION_ID;
 
     private int formatId;
     private byte[] branchQualifier;
     private byte[] globalTransactionId;
-    
+
     private transient int hash;
     private transient String transactionKey;
-    
-    public XATransactionId() {        
+
+    public XATransactionId() {
     }
-    
+
     public XATransactionId(Xid xid) {
         this.formatId = xid.getFormatId();
         this.globalTransactionId = xid.getGlobalTransactionId();
         this.branchQualifier = xid.getBranchQualifier();
     }
-    
+
     public byte getDataStructureType() {
         return DATA_STRUCTURE_TYPE;
     }
-        
-    public synchronized String getTransactionKey(){
-        if(transactionKey==null){
-            transactionKey="XID:"+formatId+":"+HexSupport.toHexFromBytes(globalTransactionId)+":"
-                    +HexSupport.toHexFromBytes(branchQualifier);
+
+    public synchronized String getTransactionKey() {
+        if (transactionKey == null) {
+            transactionKey = "XID:" + formatId + ":" + HexSupport.toHexFromBytes(globalTransactionId) + ":"
+                             + HexSupport.toHexFromBytes(branchQualifier);
         }
         return transactionKey;
     }
@@ -60,7 +59,7 @@
     public String toString() {
         return getTransactionKey();
     }
-    
+
     public boolean isXATransaction() {
         return true;
     }
@@ -92,21 +91,21 @@
 
     public void setBranchQualifier(byte[] branchQualifier) {
         this.branchQualifier = branchQualifier;
-        this.hash=0;
+        this.hash = 0;
     }
 
     public void setFormatId(int formatId) {
         this.formatId = formatId;
-        this.hash=0;
+        this.hash = 0;
     }
 
     public void setGlobalTransactionId(byte[] globalTransactionId) {
         this.globalTransactionId = globalTransactionId;
-        this.hash=0;
+        this.hash = 0;
     }
 
     public int hashCode() {
-        if( hash==0 ) {
+        if (hash == 0) {
             hash = formatId;
             hash = hash(globalTransactionId, hash);
             hash = hash(branchQualifier, hash);
@@ -123,20 +122,20 @@
         }
         return hash;
     }
-    
+
     public boolean equals(Object o) {
-        if( o==null || o.getClass()!=XATransactionId.class )
+        if (o == null || o.getClass() != XATransactionId.class)
             return false;
         XATransactionId xid = (XATransactionId)o;
-        return xid.formatId==formatId && Arrays.equals(xid.globalTransactionId,globalTransactionId)
+        return xid.formatId == formatId && Arrays.equals(xid.globalTransactionId, globalTransactionId)
                && Arrays.equals(xid.branchQualifier, branchQualifier);
     }
 
-    public int compareTo(Object o){
-        if( o==null || o.getClass()!=XATransactionId.class )
+    public int compareTo(Object o) {
+        if (o == null || o.getClass() != XATransactionId.class)
             return -1;
         XATransactionId xid = (XATransactionId)o;
         return getTransactionKey().compareTo(xid.getTransactionKey());
     }
-    
+
 }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/filter/ArithmeticExpression.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/filter/ArithmeticExpression.java?view=diff&rev=563982&r1=563981&r2=563982
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/filter/ArithmeticExpression.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/filter/ArithmeticExpression.java Wed Aug  8 11:56:59 2007
@@ -41,12 +41,11 @@
         return new ArithmeticExpression(left, right) {
             protected Object evaluate(Object lvalue, Object rvalue) {
                 if (lvalue instanceof String) {
-                    String text = (String) lvalue;
+                    String text = (String)lvalue;
                     String answer = text + rvalue;
                     return answer;
-                }
-                else if (lvalue instanceof Number) {
-                    return plus((Number) lvalue, asNumber(rvalue));
+                } else if (lvalue instanceof Number) {
+                    return plus((Number)lvalue, asNumber(rvalue));
                 }
                 throw new RuntimeException("Cannot call plus operation on: " + lvalue + " and: " + rvalue);
             }
@@ -61,7 +60,7 @@
         return new ArithmeticExpression(left, right) {
             protected Object evaluate(Object lvalue, Object rvalue) {
                 if (lvalue instanceof Number) {
-                    return minus((Number) lvalue, asNumber(rvalue));
+                    return minus((Number)lvalue, asNumber(rvalue));
                 }
                 throw new RuntimeException("Cannot call minus operation on: " + lvalue + " and: " + rvalue);
             }
@@ -77,7 +76,7 @@
 
             protected Object evaluate(Object lvalue, Object rvalue) {
                 if (lvalue instanceof Number) {
-                    return multiply((Number) lvalue, asNumber(rvalue));
+                    return multiply((Number)lvalue, asNumber(rvalue));
                 }
                 throw new RuntimeException("Cannot call multiply operation on: " + lvalue + " and: " + rvalue);
             }
@@ -93,7 +92,7 @@
 
             protected Object evaluate(Object lvalue, Object rvalue) {
                 if (lvalue instanceof Number) {
-                    return divide((Number) lvalue, asNumber(rvalue));
+                    return divide((Number)lvalue, asNumber(rvalue));
                 }
                 throw new RuntimeException("Cannot call divide operation on: " + lvalue + " and: " + rvalue);
             }
@@ -109,7 +108,7 @@
 
             protected Object evaluate(Object lvalue, Object rvalue) {
                 if (lvalue instanceof Number) {
-                    return mod((Number) lvalue, asNumber(rvalue));
+                    return mod((Number)lvalue, asNumber(rvalue));
                 }
                 throw new RuntimeException("Cannot call mod operation on: " + lvalue + " and: " + rvalue);
             }
@@ -122,34 +121,34 @@
 
     protected Number plus(Number left, Number right) {
         switch (numberType(left, right)) {
-            case INTEGER:
-                return new Integer(left.intValue() + right.intValue());
-            case LONG:
-                return new Long(left.longValue() + right.longValue());
-            default:
-                return new Double(left.doubleValue() + right.doubleValue());
+        case INTEGER:
+            return new Integer(left.intValue() + right.intValue());
+        case LONG:
+            return new Long(left.longValue() + right.longValue());
+        default:
+            return new Double(left.doubleValue() + right.doubleValue());
         }
     }
 
     protected Number minus(Number left, Number right) {
         switch (numberType(left, right)) {
-            case INTEGER:
-                return new Integer(left.intValue() - right.intValue());
-            case LONG:
-                return new Long(left.longValue() - right.longValue());
-            default:
-                return new Double(left.doubleValue() - right.doubleValue());
+        case INTEGER:
+            return new Integer(left.intValue() - right.intValue());
+        case LONG:
+            return new Long(left.longValue() - right.longValue());
+        default:
+            return new Double(left.doubleValue() - right.doubleValue());
         }
     }
 
     protected Number multiply(Number left, Number right) {
         switch (numberType(left, right)) {
-            case INTEGER:
-                return new Integer(left.intValue() * right.intValue());
-            case LONG:
-                return new Long(left.longValue() * right.longValue());
-            default:
-                return new Double(left.doubleValue() * right.doubleValue());
+        case INTEGER:
+            return new Integer(left.intValue() * right.intValue());
+        case LONG:
+            return new Long(left.longValue() * right.longValue());
+        default:
+            return new Double(left.doubleValue() * right.doubleValue());
         }
     }
 
@@ -164,11 +163,9 @@
     private int numberType(Number left, Number right) {
         if (isDouble(left) || isDouble(right)) {
             return DOUBLE;
-        }
-        else if (left instanceof Long || right instanceof Long) {
+        } else if (left instanceof Long || right instanceof Long) {
             return LONG;
-        }
-        else {
+        } else {
             return INTEGER;
         }
     }
@@ -179,9 +176,8 @@
 
     protected Number asNumber(Object value) {
         if (value instanceof Number) {
-            return (Number) value;
-        }
-        else {
+            return (Number)value;
+        } else {
             throw new RuntimeException("Cannot convert value: " + value + " into a number");
         }
     }
@@ -197,7 +193,6 @@
         }
         return evaluate(lvalue, rvalue);
     }
-
 
     /**
      * @param lvalue

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/filter/ComparisonExpression.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/filter/ComparisonExpression.java?view=diff&rev=563982&r1=563981&r2=563982
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/filter/ComparisonExpression.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/filter/ComparisonExpression.java Wed Aug  8 11:56:59 2007
@@ -30,7 +30,8 @@
 public abstract class ComparisonExpression extends BinaryExpression implements BooleanExpression {
 
     public static BooleanExpression createBetween(Expression value, Expression left, Expression right) {
-        return LogicExpression.createAND(createGreaterThanEqual(value, left), createLessThanEqual(value, right));
+        return LogicExpression.createAND(createGreaterThanEqual(value, left), createLessThanEqual(value,
+                                                                                                  right));
     }
 
     public static BooleanExpression createNotBetween(Expression value, Expression left, Expression right) {
@@ -86,18 +87,14 @@
                     char t = like.charAt(i);
                     regexp.append("\\x");
                     regexp.append(Integer.toHexString(0xFFFF & t));
-                }
-                else if (c == '%') {
-                    regexp.append(".*?"); // Do a non-greedy match 
-                }
-                else if (c == '_') {
-                    regexp.append("."); // match one 
-                }
-                else if (REGEXP_CONTROL_CHARS.contains(new Character(c))) {
+                } else if (c == '%') {
+                    regexp.append(".*?"); // Do a non-greedy match
+                } else if (c == '_') {
+                    regexp.append("."); // match one
+                } else if (REGEXP_CONTROL_CHARS.contains(new Character(c))) {
                     regexp.append("\\x");
                     regexp.append(Integer.toHexString(0xFFFF & c));
-                }
-                else {
+                } else {
                     regexp.append(c);
                 }
             }
@@ -125,22 +122,25 @@
             }
 
             if (!(rv instanceof String)) {
-            	return Boolean.FALSE;
-                //throw new RuntimeException("LIKE can only operate on String identifiers.  LIKE attemped on: '" + rv.getClass());
+                return Boolean.FALSE;
+                // throw new RuntimeException("LIKE can only operate on String
+                // identifiers. LIKE attemped on: '" + rv.getClass());
             }
 
-            return likePattern.matcher((String) rv).matches() ? Boolean.TRUE : Boolean.FALSE;
+            return likePattern.matcher((String)rv).matches() ? Boolean.TRUE : Boolean.FALSE;
         }
-        
+
         public boolean matches(MessageEvaluationContext message) throws JMSException {
             Object object = evaluate(message);
-            return object!=null && object==Boolean.TRUE;            
+            return object != null && object == Boolean.TRUE;
         }
     }
 
     public static BooleanExpression createLike(Expression left, String right, String escape) {
         if (escape != null && escape.length() != 1) {
-            throw new RuntimeException("The ESCAPE string litteral is invalid.  It can only be one character.  Litteral used: " + escape);
+            throw new RuntimeException(
+                                       "The ESCAPE string litteral is invalid.  It can only be one character.  Litteral used: "
+                                           + escape);
         }
         int c = -1;
         if (escape != null) {
@@ -152,21 +152,21 @@
 
     public static BooleanExpression createNotLike(Expression left, String right, String escape) {
         return UnaryExpression.createNOT(createLike(left, right, escape));
-    }    
+    }
 
     public static BooleanExpression createInFilter(Expression left, List elements) {
-    	
-    	if( !(left instanceof PropertyExpression) )
-    		throw new RuntimeException("Expected a property for In expression, got: "+left);    	
-    	return UnaryExpression.createInExpression((PropertyExpression)left, elements, false);
-    	
+
+        if (!(left instanceof PropertyExpression))
+            throw new RuntimeException("Expected a property for In expression, got: " + left);
+        return UnaryExpression.createInExpression((PropertyExpression)left, elements, false);
+
     }
 
     public static BooleanExpression createNotInFilter(Expression left, List elements) {
-    	
-    	if( !(left instanceof PropertyExpression) )
-    		throw new RuntimeException("Expected a property for In expression, got: "+left);    	
-    	return UnaryExpression.createInExpression((PropertyExpression)left, elements, true);
+
+        if (!(left instanceof PropertyExpression))
+            throw new RuntimeException("Expected a property for In expression, got: " + left);
+        return UnaryExpression.createInExpression((PropertyExpression)left, elements, true);
 
     }
 
@@ -183,27 +183,27 @@
     }
 
     public static BooleanExpression createEqual(Expression left, Expression right) {
-    	checkEqualOperand(left);
-    	checkEqualOperand(right);
-    	checkEqualOperandCompatability(left, right);
-    	return doCreateEqual(left, right);
+        checkEqualOperand(left);
+        checkEqualOperand(right);
+        checkEqualOperandCompatability(left, right);
+        return doCreateEqual(left, right);
     }
-    
-	private static BooleanExpression doCreateEqual(Expression left, Expression right) {
+
+    private static BooleanExpression doCreateEqual(Expression left, Expression right) {
         return new ComparisonExpression(left, right) {
 
             public Object evaluate(MessageEvaluationContext message) throws JMSException {
                 Object lv = left.evaluate(message);
                 Object rv = right.evaluate(message);
-                
+
                 // Iff one of the values is null
                 if (lv == null ^ rv == null) {
                     return Boolean.FALSE;
                 }
                 if (lv == rv || lv.equals(rv)) {
                     return Boolean.TRUE;
-                }                
-                if( lv instanceof Comparable && rv instanceof Comparable ) {
+                }
+                if (lv instanceof Comparable && rv instanceof Comparable) {
                     return compare((Comparable)lv, (Comparable)rv);
                 }
                 return Boolean.FALSE;
@@ -220,8 +220,8 @@
     }
 
     public static BooleanExpression createGreaterThan(final Expression left, final Expression right) {
-    	checkLessThanOperand(left);
-    	checkLessThanOperand(right);
+        checkLessThanOperand(left);
+        checkLessThanOperand(right);
         return new ComparisonExpression(left, right) {
             protected boolean asBoolean(int answer) {
                 return answer > 0;
@@ -234,8 +234,8 @@
     }
 
     public static BooleanExpression createGreaterThanEqual(final Expression left, final Expression right) {
-    	checkLessThanOperand(left);
-    	checkLessThanOperand(right);
+        checkLessThanOperand(left);
+        checkLessThanOperand(right);
         return new ComparisonExpression(left, right) {
             protected boolean asBoolean(int answer) {
                 return answer >= 0;
@@ -248,8 +248,8 @@
     }
 
     public static BooleanExpression createLessThan(final Expression left, final Expression right) {
-    	checkLessThanOperand(left);
-    	checkLessThanOperand(right);
+        checkLessThanOperand(left);
+        checkLessThanOperand(right);
         return new ComparisonExpression(left, right) {
 
             protected boolean asBoolean(int answer) {
@@ -263,9 +263,9 @@
         };
     }
 
-	public static BooleanExpression createLessThanEqual(final Expression left, final Expression right) {
-    	checkLessThanOperand(left);
-    	checkLessThanOperand(right);
+    public static BooleanExpression createLessThanEqual(final Expression left, final Expression right) {
+        checkLessThanOperand(left);
+        checkLessThanOperand(right);
         return new ComparisonExpression(left, right) {
 
             protected boolean asBoolean(int answer) {
@@ -278,53 +278,51 @@
         };
     }
 
-	/**
-     * Only Numeric expressions can be used in >, >=, < or <= expressions.s 
+    /**
+     * Only Numeric expressions can be used in >, >=, < or <= expressions.s
+     * 
+     * @param expr
+     */
+    public static void checkLessThanOperand(Expression expr) {
+        if (expr instanceof ConstantExpression) {
+            Object value = ((ConstantExpression)expr).getValue();
+            if (value instanceof Number)
+                return;
+
+            // Else it's boolean or a String..
+            throw new RuntimeException("Value '" + expr + "' cannot be compared.");
+        }
+        if (expr instanceof BooleanExpression) {
+            throw new RuntimeException("Value '" + expr + "' cannot be compared.");
+        }
+    }
+
+    /**
+     * Validates that the expression can be used in == or <> expression. Cannot
+     * not be NULL TRUE or FALSE litterals.
      * 
-	 * @param expr
-	 */
-	public static void checkLessThanOperand(Expression expr ) {
-		if( expr instanceof ConstantExpression ) {
-			Object value = ((ConstantExpression)expr).getValue();
-			if( value instanceof Number )
-				return;
-			
-			// Else it's boolean or a String..  
-			throw new RuntimeException("Value '"+expr+"' cannot be compared.");
-		}
-		if( expr instanceof BooleanExpression ) {
-			throw new RuntimeException("Value '"+expr+"' cannot be compared.");
-		}		
-	}
-
-	/**
-     * Validates that the expression can be used in == or <> expression.  
-     * Cannot not be NULL TRUE or FALSE litterals.
+     * @param expr
+     */
+    public static void checkEqualOperand(Expression expr) {
+        if (expr instanceof ConstantExpression) {
+            Object value = ((ConstantExpression)expr).getValue();
+            if (value == null)
+                throw new RuntimeException("'" + expr + "' cannot be compared.");
+        }
+    }
+
+    /**
      * 
-	 * @param expr
-	 */
-	public static void checkEqualOperand(Expression expr ) {
-		if( expr instanceof ConstantExpression ) {
-			Object value = ((ConstantExpression)expr).getValue();
-			if( value == null )
-				throw new RuntimeException("'"+expr+"' cannot be compared.");
-		}
-	}
-
-	/**
-	 * 
-	 * @param left
-	 * @param right
-	 */
-	private static void checkEqualOperandCompatability(Expression left, Expression right) {
-		if( left instanceof ConstantExpression && right instanceof ConstantExpression ) {
-			if( left instanceof BooleanExpression && !(right instanceof BooleanExpression) )
-				throw new RuntimeException("'"+left+"' cannot be compared with '"+right+"'");
-		}
-	}
+     * @param left
+     * @param right
+     */
+    private static void checkEqualOperandCompatability(Expression left, Expression right) {
+        if (left instanceof ConstantExpression && right instanceof ConstantExpression) {
+            if (left instanceof BooleanExpression && !(right instanceof BooleanExpression))
+                throw new RuntimeException("'" + left + "' cannot be compared with '" + right + "'");
+        }
+    }
 
-	
-	
     /**
      * @param left
      * @param right
@@ -334,11 +332,11 @@
     }
 
     public Object evaluate(MessageEvaluationContext message) throws JMSException {
-        Comparable lv = (Comparable) left.evaluate(message);
+        Comparable lv = (Comparable)left.evaluate(message);
         if (lv == null) {
             return null;
         }
-        Comparable rv = (Comparable) right.evaluate(message);
+        Comparable rv = (Comparable)right.evaluate(message);
         if (rv == null) {
             return null;
         }
@@ -353,106 +351,81 @@
         if (lc != rc) {
             if (lc == Byte.class) {
                 if (rc == Short.class) {
-                    lv = Short.valueOf(((Number) lv).shortValue());
-                }
-                else if (rc == Integer.class) {
-                    lv = Integer.valueOf(((Number) lv).intValue());
-                }
-                else if (rc == Long.class) {
-                    lv = Long.valueOf(((Number) lv).longValue());
-                }
-                else if (rc == Float.class) {
-                    lv = new Float(((Number) lv).floatValue());
-                }
-                else if (rc == Double.class) {
-                    lv = new Double(((Number) lv).doubleValue());
-                }
-                else {
+                    lv = Short.valueOf(((Number)lv).shortValue());
+                } else if (rc == Integer.class) {
+                    lv = Integer.valueOf(((Number)lv).intValue());
+                } else if (rc == Long.class) {
+                    lv = Long.valueOf(((Number)lv).longValue());
+                } else if (rc == Float.class) {
+                    lv = new Float(((Number)lv).floatValue());
+                } else if (rc == Double.class) {
+                    lv = new Double(((Number)lv).doubleValue());
+                } else {
                     return Boolean.FALSE;
                 }
-             } else if (lc == Short.class) {
+            } else if (lc == Short.class) {
                 if (rc == Integer.class) {
-                    lv = Integer.valueOf(((Number) lv).intValue());
-                }
-                else if (rc == Long.class) {
-                    lv = Long.valueOf(((Number) lv).longValue());
-                }
-                else if (rc == Float.class) {
-                    lv = new Float(((Number) lv).floatValue());
-                }
-                else if (rc == Double.class) {
-                    lv = new Double(((Number) lv).doubleValue());
-                }
-                else {
+                    lv = Integer.valueOf(((Number)lv).intValue());
+                } else if (rc == Long.class) {
+                    lv = Long.valueOf(((Number)lv).longValue());
+                } else if (rc == Float.class) {
+                    lv = new Float(((Number)lv).floatValue());
+                } else if (rc == Double.class) {
+                    lv = new Double(((Number)lv).doubleValue());
+                } else {
                     return Boolean.FALSE;
                 }
             } else if (lc == Integer.class) {
                 if (rc == Long.class) {
-                    lv = Long.valueOf(((Number) lv).longValue());
-                }
-                else if (rc == Float.class) {
-                    lv = new Float(((Number) lv).floatValue());
-                }
-                else if (rc == Double.class) {
-                    lv = new Double(((Number) lv).doubleValue());
-                }
-                else {
+                    lv = Long.valueOf(((Number)lv).longValue());
+                } else if (rc == Float.class) {
+                    lv = new Float(((Number)lv).floatValue());
+                } else if (rc == Double.class) {
+                    lv = new Double(((Number)lv).doubleValue());
+                } else {
                     return Boolean.FALSE;
                 }
-            }
-            else if (lc == Long.class) {
+            } else if (lc == Long.class) {
                 if (rc == Integer.class) {
-                    rv = Long.valueOf(((Number) rv).longValue());
-                }
-                else if (rc == Float.class) {
-                    lv = new Float(((Number) lv).floatValue());
-                }
-                else if (rc == Double.class) {
-                    lv = new Double(((Number) lv).doubleValue());
-                }
-                else {
+                    rv = Long.valueOf(((Number)rv).longValue());
+                } else if (rc == Float.class) {
+                    lv = new Float(((Number)lv).floatValue());
+                } else if (rc == Double.class) {
+                    lv = new Double(((Number)lv).doubleValue());
+                } else {
                     return Boolean.FALSE;
                 }
-            }
-            else if (lc == Float.class) {
+            } else if (lc == Float.class) {
                 if (rc == Integer.class) {
-                    rv = new Float(((Number) rv).floatValue());
-                }
-                else if (rc == Long.class) {
-                    rv = new Float(((Number) rv).floatValue());
-                }
-                else if (rc == Double.class) {
-                    lv = new Double(((Number) lv).doubleValue());
-                }
-                else {
+                    rv = new Float(((Number)rv).floatValue());
+                } else if (rc == Long.class) {
+                    rv = new Float(((Number)rv).floatValue());
+                } else if (rc == Double.class) {
+                    lv = new Double(((Number)lv).doubleValue());
+                } else {
                     return Boolean.FALSE;
                 }
-            } 
-            else if (lc == Double.class) {
+            } else if (lc == Double.class) {
                 if (rc == Integer.class) {
-                    rv = new Double(((Number) rv).doubleValue());
-                }
-                else if (rc == Long.class) {
-                    rv = new Double(((Number) rv).doubleValue());
-                }
-                else if (rc == Float.class) {
-                	rv = new Float(((Number) rv).doubleValue());
-                }
-                else {
+                    rv = new Double(((Number)rv).doubleValue());
+                } else if (rc == Long.class) {
+                    rv = new Double(((Number)rv).doubleValue());
+                } else if (rc == Float.class) {
+                    rv = new Float(((Number)rv).doubleValue());
+                } else {
                     return Boolean.FALSE;
                 }
-            } 
-            else 
+            } else
                 return Boolean.FALSE;
         }
         return asBoolean(lv.compareTo(rv)) ? Boolean.TRUE : Boolean.FALSE;
     }
 
     protected abstract boolean asBoolean(int answer);
-    
+
     public boolean matches(MessageEvaluationContext message) throws JMSException {
         Object object = evaluate(message);
-        return object!=null && object==Boolean.TRUE;            
+        return object != null && object == Boolean.TRUE;
     }
 
 }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/filter/ConstantExpression.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/filter/ConstantExpression.java?view=diff&rev=563982&r1=563981&r2=563982
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/filter/ConstantExpression.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/filter/ConstantExpression.java Wed Aug  8 11:56:59 2007
@@ -31,10 +31,11 @@
         public BooleanConstantExpression(Object value) {
             super(value);
         }
+
         public boolean matches(MessageEvaluationContext message) throws JMSException {
             Object object = evaluate(message);
-            return object!=null && object==Boolean.TRUE;            
-        }        
+            return object != null && object == Boolean.TRUE;
+        }
     }
 
     public static final BooleanConstantExpression NULL = new BooleanConstantExpression(null);
@@ -44,19 +45,19 @@
     private Object value;
 
     public static ConstantExpression createFromDecimal(String text) {
-    	    	
-    	// Strip off the 'l' or 'L' if needed.
-    	if( text.endsWith("l") || text.endsWith("L") )
-    		text = text.substring(0, text.length()-1);
-
-    	Number value;
-    	try {
-    		value = new Long(text);
-    	} catch ( NumberFormatException e) {
-    		// The number may be too big to fit in a long.
-        	value = new BigDecimal(text);    		
-    	}
-    	
+
+        // Strip off the 'l' or 'L' if needed.
+        if (text.endsWith("l") || text.endsWith("L"))
+            text = text.substring(0, text.length() - 1);
+
+        Number value;
+        try {
+            value = new Long(text);
+        } catch (NumberFormatException e) {
+            // The number may be too big to fit in a long.
+            value = new BigDecimal(text);
+        }
+
         long l = value.longValue();
         if (Integer.MIN_VALUE <= l && l <= Integer.MAX_VALUE) {
             value = Integer.valueOf(value.intValue());
@@ -97,7 +98,7 @@
 
     public Object getValue() {
         return value;
-    }    
+    }
 
     /**
      * @see java.lang.Object#toString()
@@ -107,17 +108,17 @@
             return "NULL";
         }
         if (value instanceof Boolean) {
-            return ((Boolean) value).booleanValue() ? "TRUE" : "FALSE";
+            return ((Boolean)value).booleanValue() ? "TRUE" : "FALSE";
         }
         if (value instanceof String) {
-            return encodeString((String) value);
+            return encodeString((String)value);
         }
         return value.toString();
     }
 
     /**
      * TODO: more efficient hashCode()
-     *
+     * 
      * @see java.lang.Object#hashCode()
      */
     public int hashCode() {
@@ -126,7 +127,7 @@
 
     /**
      * TODO: more efficient hashCode()
-     *
+     * 
      * @see java.lang.Object#equals(java.lang.Object)
      */
     public boolean equals(Object o) {
@@ -138,11 +139,10 @@
 
     }
 
-
     /**
-     * Encodes the value of string so that it looks like it would look like
-     * when it was provided in a selector.
-     *
+     * Encodes the value of string so that it looks like it would look like when
+     * it was provided in a selector.
+     * 
      * @param string
      * @return
      */
@@ -159,5 +159,5 @@
         b.append('\'');
         return b.toString();
     }
-    
+
 }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/filter/DestinationFilter.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/filter/DestinationFilter.java?view=diff&rev=563982&r1=563981&r2=563982
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/filter/DestinationFilter.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/filter/DestinationFilter.java Wed Aug  8 11:56:59 2007
@@ -24,24 +24,23 @@
 import org.apache.activemq.command.ActiveMQDestination;
 import org.apache.activemq.util.JMSExceptionSupport;
 
-
 /**
  * Represents a filter which only operates on Destinations
- *
+ * 
  * @version $Revision: 1.3 $
  */
 public abstract class DestinationFilter implements BooleanExpression {
-    
+
     public static final String ANY_DESCENDENT = ">";
     public static final String ANY_CHILD = "*";
 
     public Object evaluate(MessageEvaluationContext message) throws JMSException {
         return matches(message) ? Boolean.TRUE : Boolean.FALSE;
     }
-    
+
     public boolean matches(MessageEvaluationContext message) throws JMSException {
         try {
-            if( message.isDropped() )
+            if (message.isDropped())
                 return false;
             return matches(message.getMessage().getDestination());
         } catch (IOException e) {
@@ -61,8 +60,7 @@
             String lastPath = paths[idx];
             if (lastPath.equals(ANY_DESCENDENT)) {
                 return new PrefixDestinationFilter(paths);
-            }
-            else {
+            } else {
                 while (idx >= 0) {
                     lastPath = paths[idx--];
                     if (lastPath.equals(ANY_CHILD)) {

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/filter/DestinationMapNode.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/filter/DestinationMapNode.java?view=diff&rev=563982&r1=563981&r2=563982
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/filter/DestinationMapNode.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/filter/DestinationMapNode.java Wed Aug  8 11:56:59 2007
@@ -39,15 +39,14 @@
     private List values = new ArrayList();
     private Map childNodes = new HashMap();
     private String path = "Root";
-//    private DestinationMapNode anyChild;
+    // private DestinationMapNode anyChild;
     private int pathLength;
 
     public DestinationMapNode(DestinationMapNode parent) {
         this.parent = parent;
         if (parent == null) {
             pathLength = 0;
-        }
-        else {
+        } else {
             pathLength = parent.pathLength + 1;
         }
     }
@@ -57,7 +56,7 @@
      * exist
      */
     public DestinationMapNode getChild(String path) {
-        return (DestinationMapNode) childNodes.get(path);
+        return (DestinationMapNode)childNodes.get(path);
     }
 
     /**
@@ -66,7 +65,7 @@
     public Collection getChildren() {
         return childNodes.values();
     }
-    
+
     public int getChildCount() {
         return childNodes.size();
     }
@@ -76,7 +75,7 @@
      * it does not yet exist
      */
     public DestinationMapNode getChildOrCreate(String path) {
-        DestinationMapNode answer = (DestinationMapNode) childNodes.get(path);
+        DestinationMapNode answer = (DestinationMapNode)childNodes.get(path);
         if (answer == null) {
             answer = createChildNode();
             answer.path = path;
@@ -88,13 +87,12 @@
     /**
      * Returns the node which represents all children (i.e. the * node)
      */
-//    public DestinationMapNode getAnyChildNode() {
-//        if (anyChild == null) {
-//            anyChild = createChildNode();
-//        }
-//        return anyChild;
-//    }
-
+    // public DestinationMapNode getAnyChildNode() {
+    // if (anyChild == null) {
+    // anyChild = createChildNode();
+    // }
+    // return anyChild;
+    // }
     /**
      * Returns a mutable List of the values available at this node in the tree
      */
@@ -106,24 +104,23 @@
      * Returns a mutable List of the values available at this node in the tree
      */
     public List removeValues() {
-    	ArrayList v = new ArrayList(values);
-//    	parent.getAnyChildNode().getValues().removeAll(v);
-    	values.clear();
-    	pruneIfEmpty();
+        ArrayList v = new ArrayList(values);
+        // parent.getAnyChildNode().getValues().removeAll(v);
+        values.clear();
+        pruneIfEmpty();
         return v;
     }
-    
-    
+
     public Set removeDesendentValues() {
         Set answer = new HashSet();
         removeDesendentValues(answer);
         return answer;
     }
-    
+
     protected void removeDesendentValues(Set answer) {
-//        if (anyChild != null) {
-//            anyChild.removeDesendentValues(answer);
-//        }
+        // if (anyChild != null) {
+        // anyChild.removeDesendentValues(answer);
+        // }
         answer.addAll(removeValues());
     }
 
@@ -139,14 +136,13 @@
     public void add(String[] paths, int idx, Object value) {
         if (idx >= paths.length) {
             values.add(value);
-        }
-        else {
-//            if (idx == paths.length - 1) {
-//                getAnyChildNode().getValues().add(value);
-//            }
-//            else {
-//                getAnyChildNode().add(paths, idx + 1, value);
-//            }
+        } else {
+            // if (idx == paths.length - 1) {
+            // getAnyChildNode().getValues().add(value);
+            // }
+            // else {
+            // getAnyChildNode().add(paths, idx + 1, value);
+            // }
             getChildOrCreate(paths[idx]).add(paths, idx + 1, value);
         }
     }
@@ -155,14 +151,13 @@
         if (idx >= paths.length) {
             values.remove(value);
             pruneIfEmpty();
-        }
-        else {
-//            if (idx == paths.length - 1) {
-//                getAnyChildNode().getValues().remove(value);
-//            }
-//            else {
-//                getAnyChildNode().remove(paths, idx + 1, value);
-//            }
+        } else {
+            // if (idx == paths.length - 1) {
+            // getAnyChildNode().getValues().remove(value);
+            // }
+            // else {
+            // getAnyChildNode().remove(paths, idx + 1, value);
+            // }
             getChildOrCreate(paths[idx]).remove(paths, ++idx, value);
         }
     }
@@ -171,7 +166,7 @@
         DestinationNode node = this;
         for (int i = startIndex, size = paths.length; i < size && node != null; i++) {
 
-        	String path = paths[i];
+            String path = paths[i];
             if (path.equals(ANY_DESCENDENT)) {
                 answer.addAll(node.removeDesendentValues());
                 break;
@@ -179,19 +174,17 @@
 
             node.appendMatchingWildcards(answer, paths, i);
             if (path.equals(ANY_CHILD)) {
-                //node = node.getAnyChildNode();
+                // node = node.getAnyChildNode();
                 node = new AnyChildDestinationNode(node);
-            }
-            else {
+            } else {
                 node = node.getChild(path);
             }
         }
-        
+
         if (node != null) {
             answer.addAll(node.removeValues());
         }
 
-        
     }
 
     public void appendDescendantValues(Set answer) {
@@ -200,14 +193,14 @@
         // lets add all the children too
         Iterator iter = childNodes.values().iterator();
         while (iter.hasNext()) {
-            DestinationNode child = (DestinationNode) iter.next();
+            DestinationNode child = (DestinationNode)iter.next();
             child.appendDescendantValues(answer);
         }
-        
+
         // TODO???
-//        if (anyChild != null) {
-//            anyChild.appendDescendantValues(answer);
-//        }
+        // if (anyChild != null) {
+        // anyChild.appendDescendantValues(answer);
+        // }
     }
 
     /**
@@ -226,7 +219,7 @@
         }
         DestinationMapNode wildCardNode = getChild(ANY_CHILD);
         if (wildCardNode != null) {
-            wildCardNode.appendMatchingValues(answer, paths, idx+1);
+            wildCardNode.appendMatchingValues(answer, paths, idx + 1);
         }
         wildCardNode = getChild(ANY_DESCENDENT);
         if (wildCardNode != null) {
@@ -247,11 +240,9 @@
 
             node.appendMatchingWildcards(answer, paths, i);
 
-
             if (path.equals(ANY_CHILD)) {
                 node = new AnyChildDestinationNode(node);
-            }
-            else {
+            } else {
                 node = node.getChild(path);
             }
         }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/filter/PropertyExpression.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/filter/PropertyExpression.java?view=diff&rev=563982&r1=563981&r2=563982
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/filter/PropertyExpression.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/filter/PropertyExpression.java Wed Aug  8 11:56:59 2007
@@ -29,7 +29,7 @@
 import org.apache.activemq.util.JMSExceptionSupport;
 
 /**
- * Represents a property  expression
+ * Represents a property expression
  * 
  * @version $Revision: 1.5 $
  */
@@ -38,149 +38,151 @@
     interface SubExpression {
         public Object evaluate(Message message);
     }
-    
-    static final private HashMap JMS_PROPERTY_EXPRESSIONS = new HashMap();  
-    static{
-        JMS_PROPERTY_EXPRESSIONS.put("JMSDestination",new SubExpression(){
-
-            public Object evaluate(Message message){
-                ActiveMQDestination dest=message.getOriginalDestination();
-                if(dest==null)
-                    dest=message.getDestination();
-                if(dest==null)
+
+    static final private HashMap JMS_PROPERTY_EXPRESSIONS = new HashMap();
+    static {
+        JMS_PROPERTY_EXPRESSIONS.put("JMSDestination", new SubExpression() {
+
+            public Object evaluate(Message message) {
+                ActiveMQDestination dest = message.getOriginalDestination();
+                if (dest == null)
+                    dest = message.getDestination();
+                if (dest == null)
                     return null;
                 return dest.toString();
             }
         });
-        JMS_PROPERTY_EXPRESSIONS.put("JMSReplyTo",new SubExpression(){
+        JMS_PROPERTY_EXPRESSIONS.put("JMSReplyTo", new SubExpression() {
 
-            public Object evaluate(Message message){
-                if(message.getReplyTo()==null)
+            public Object evaluate(Message message) {
+                if (message.getReplyTo() == null)
                     return null;
                 return message.getReplyTo().toString();
             }
         });
-        JMS_PROPERTY_EXPRESSIONS.put("JMSType",new SubExpression(){
+        JMS_PROPERTY_EXPRESSIONS.put("JMSType", new SubExpression() {
 
-            public Object evaluate(Message message){
+            public Object evaluate(Message message) {
                 return message.getType();
             }
         });
-        JMS_PROPERTY_EXPRESSIONS.put("JMSDeliveryMode",new SubExpression(){
+        JMS_PROPERTY_EXPRESSIONS.put("JMSDeliveryMode", new SubExpression() {
 
-            public Object evaluate(Message message){
-                return Integer.valueOf(message.isPersistent()?DeliveryMode.PERSISTENT:DeliveryMode.NON_PERSISTENT);
+            public Object evaluate(Message message) {
+                return Integer.valueOf(message.isPersistent()
+                    ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT);
             }
         });
-        JMS_PROPERTY_EXPRESSIONS.put("JMSPriority",new SubExpression(){
+        JMS_PROPERTY_EXPRESSIONS.put("JMSPriority", new SubExpression() {
 
-            public Object evaluate(Message message){
+            public Object evaluate(Message message) {
                 return Integer.valueOf(message.getPriority());
             }
         });
-        JMS_PROPERTY_EXPRESSIONS.put("JMSMessageID",new SubExpression(){
+        JMS_PROPERTY_EXPRESSIONS.put("JMSMessageID", new SubExpression() {
 
-            public Object evaluate(Message message){
-                if(message.getMessageId()==null)
+            public Object evaluate(Message message) {
+                if (message.getMessageId() == null)
                     return null;
                 return message.getMessageId().toString();
             }
         });
-        JMS_PROPERTY_EXPRESSIONS.put("JMSTimestamp",new SubExpression(){
+        JMS_PROPERTY_EXPRESSIONS.put("JMSTimestamp", new SubExpression() {
 
-            public Object evaluate(Message message){
+            public Object evaluate(Message message) {
                 return Long.valueOf(message.getTimestamp());
             }
         });
-        JMS_PROPERTY_EXPRESSIONS.put("JMSCorrelationID",new SubExpression(){
+        JMS_PROPERTY_EXPRESSIONS.put("JMSCorrelationID", new SubExpression() {
 
-            public Object evaluate(Message message){
+            public Object evaluate(Message message) {
                 return message.getCorrelationId();
             }
         });
-        JMS_PROPERTY_EXPRESSIONS.put("JMSExpiration",new SubExpression(){
+        JMS_PROPERTY_EXPRESSIONS.put("JMSExpiration", new SubExpression() {
 
-            public Object evaluate(Message message){
+            public Object evaluate(Message message) {
                 return Long.valueOf(message.getExpiration());
             }
         });
-        JMS_PROPERTY_EXPRESSIONS.put("JMSRedelivered",new SubExpression(){
+        JMS_PROPERTY_EXPRESSIONS.put("JMSRedelivered", new SubExpression() {
 
-            public Object evaluate(Message message){
+            public Object evaluate(Message message) {
                 return Boolean.valueOf(message.isRedelivered());
             }
         });
-        JMS_PROPERTY_EXPRESSIONS.put("JMSXDeliveryCount",new SubExpression(){
+        JMS_PROPERTY_EXPRESSIONS.put("JMSXDeliveryCount", new SubExpression() {
 
-            public Object evaluate(Message message){
-                return Integer.valueOf(message.getRedeliveryCounter()+1);
+            public Object evaluate(Message message) {
+                return Integer.valueOf(message.getRedeliveryCounter() + 1);
             }
         });
-        JMS_PROPERTY_EXPRESSIONS.put("JMSXGroupID",new SubExpression(){
+        JMS_PROPERTY_EXPRESSIONS.put("JMSXGroupID", new SubExpression() {
 
-            public Object evaluate(Message message){
+            public Object evaluate(Message message) {
                 return message.getGroupID();
             }
         });
-        JMS_PROPERTY_EXPRESSIONS.put("JMSXGroupSeq",new SubExpression(){
+        JMS_PROPERTY_EXPRESSIONS.put("JMSXGroupSeq", new SubExpression() {
 
-            public Object evaluate(Message message){
+            public Object evaluate(Message message) {
                 return new Integer(message.getGroupSequence());
             }
         });
-        JMS_PROPERTY_EXPRESSIONS.put("JMSXProducerTXID",new SubExpression(){
+        JMS_PROPERTY_EXPRESSIONS.put("JMSXProducerTXID", new SubExpression() {
 
-            public Object evaluate(Message message){
-                TransactionId txId=message.getOriginalTransactionId();
-                if(txId==null)
-                    txId=message.getTransactionId();
-                if(txId==null)
+            public Object evaluate(Message message) {
+                TransactionId txId = message.getOriginalTransactionId();
+                if (txId == null)
+                    txId = message.getTransactionId();
+                if (txId == null)
                     return null;
                 return new Integer(txId.toString());
             }
         });
-        JMS_PROPERTY_EXPRESSIONS.put("JMSActiveMQBrokerInTime",new SubExpression(){
+        JMS_PROPERTY_EXPRESSIONS.put("JMSActiveMQBrokerInTime", new SubExpression() {
 
-            public Object evaluate(Message message){
+            public Object evaluate(Message message) {
                 return Long.valueOf(message.getBrokerInTime());
             }
         });
-        JMS_PROPERTY_EXPRESSIONS.put("JMSActiveMQBrokerOutTime",new SubExpression(){
+        JMS_PROPERTY_EXPRESSIONS.put("JMSActiveMQBrokerOutTime", new SubExpression() {
 
-            public Object evaluate(Message message){
+            public Object evaluate(Message message) {
                 return Long.valueOf(message.getBrokerOutTime());
             }
         });
     }
-    
+
     private final String name;
     private final SubExpression jmsPropertyExpression;
-    
+
     public PropertyExpression(String name) {
         this.name = name;
-        jmsPropertyExpression = (SubExpression) JMS_PROPERTY_EXPRESSIONS.get(name);
+        jmsPropertyExpression = (SubExpression)JMS_PROPERTY_EXPRESSIONS.get(name);
     }
 
     public Object evaluate(MessageEvaluationContext message) throws JMSException {
         try {
-            if( message.isDropped() )
+            if (message.isDropped())
                 return null;
-            
-            if( jmsPropertyExpression!=null )
+
+            if (jmsPropertyExpression != null)
                 return jmsPropertyExpression.evaluate(message.getMessage());
             try {
                 return message.getMessage().getProperty(name);
             } catch (IOException ioe) {
-                throw JMSExceptionSupport.create("Could not get property: "+name+" reason: "+ioe.getMessage(), ioe);
+                throw JMSExceptionSupport.create("Could not get property: " + name + " reason: "
+                                                 + ioe.getMessage(), ioe);
             }
         } catch (IOException e) {
             throw JMSExceptionSupport.create(e);
         }
 
     }
-    
+
     public Object evaluate(Message message) throws JMSException {
-        if( jmsPropertyExpression!=null )
+        if (jmsPropertyExpression != null)
             return jmsPropertyExpression.evaluate(message);
         try {
             return message.getProperty(name);
@@ -193,7 +195,6 @@
         return name;
     }
 
-
     /**
      * @see java.lang.Object#toString()
      */
@@ -216,7 +217,7 @@
         if (o == null || !this.getClass().equals(o.getClass())) {
             return false;
         }
-        return name.equals(((PropertyExpression) o).name);
+        return name.equals(((PropertyExpression)o).name);
 
     }
 

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/filter/UnaryExpression.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/filter/UnaryExpression.java?view=diff&rev=563982&r1=563981&r2=563982
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/filter/UnaryExpression.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/filter/UnaryExpression.java Wed Aug  8 11:56:59 2007
@@ -42,7 +42,7 @@
                     return null;
                 }
                 if (rvalue instanceof Number) {
-                    return negate((Number) rvalue);
+                    return negate((Number)rvalue);
                 }
                 return null;
             }
@@ -53,83 +53,83 @@
         };
     }
 
-    public static BooleanExpression createInExpression(PropertyExpression right, List elements, final boolean not) {
-    	
-    	// Use a HashSet if there are many elements.
-    	Collection t;
-		if( elements.size()==0 )
-    		t=null;
-    	else if( elements.size() < 5 )
-    		t = elements;
-    	else {
-    		t = new HashSet(elements);
-    	}
-    	final Collection inList = t;
-    	
+    public static BooleanExpression createInExpression(PropertyExpression right, List elements,
+                                                       final boolean not) {
+
+        // Use a HashSet if there are many elements.
+        Collection t;
+        if (elements.size() == 0)
+            t = null;
+        else if (elements.size() < 5)
+            t = elements;
+        else {
+            t = new HashSet(elements);
+        }
+        final Collection inList = t;
+
         return new BooleanUnaryExpression(right) {
             public Object evaluate(MessageEvaluationContext message) throws JMSException {
-            	
+
                 Object rvalue = right.evaluate(message);
                 if (rvalue == null) {
                     return null;
                 }
-                if( rvalue.getClass()!=String.class )
-                	return null;
-                
-                if( (inList!=null && inList.contains(rvalue)) ^ not ) {
-                	return Boolean.TRUE;
+                if (rvalue.getClass() != String.class)
+                    return null;
+
+                if ((inList != null && inList.contains(rvalue)) ^ not) {
+                    return Boolean.TRUE;
                 } else {
-                	return Boolean.FALSE;                	
+                    return Boolean.FALSE;
                 }
-                
+
             }
 
             public String toString() {
-            	StringBuffer answer = new StringBuffer();
-            	answer.append(right);
-            	answer.append(" ");
-            	answer.append(getExpressionSymbol());
-            	answer.append(" ( ");
-
-            	int count=0;
-            	for (Iterator i = inList.iterator(); i.hasNext();) {
-					Object o = (Object) i.next();
-					if( count!=0 ) {
-		            	answer.append(", ");				
-					}
-	            	answer.append(o);				
-	            	count++;
-				}
-            	
-            	answer.append(" )");				
+                StringBuffer answer = new StringBuffer();
+                answer.append(right);
+                answer.append(" ");
+                answer.append(getExpressionSymbol());
+                answer.append(" ( ");
+
+                int count = 0;
+                for (Iterator i = inList.iterator(); i.hasNext();) {
+                    Object o = (Object)i.next();
+                    if (count != 0) {
+                        answer.append(", ");
+                    }
+                    answer.append(o);
+                    count++;
+                }
+
+                answer.append(" )");
                 return answer.toString();
-			}
-			
+            }
+
             public String getExpressionSymbol() {
-            	if( not )
-            		return "NOT IN";
-            	else 
-            		return "IN";
+                if (not)
+                    return "NOT IN";
+                else
+                    return "IN";
             }
         };
     }
 
     abstract static class BooleanUnaryExpression extends UnaryExpression implements BooleanExpression {
-        public BooleanUnaryExpression(Expression left) {        	
+        public BooleanUnaryExpression(Expression left) {
             super(left);
         }
 
         public boolean matches(MessageEvaluationContext message) throws JMSException {
             Object object = evaluate(message);
-            return object!=null && object==Boolean.TRUE;            
+            return object != null && object == Boolean.TRUE;
         }
     };
 
-        
     public static BooleanExpression createNOT(BooleanExpression left) {
         return new BooleanUnaryExpression(left) {
             public Object evaluate(MessageEvaluationContext message) throws JMSException {
-                Boolean lvalue = (Boolean) right.evaluate(message);
+                Boolean lvalue = (Boolean)right.evaluate(message);
                 if (lvalue == null) {
                     return null;
                 }
@@ -141,7 +141,7 @@
             }
         };
     }
-    
+
     public static BooleanExpression createXPath(final String xpath) {
         return new XPathExpression(xpath);
     }
@@ -154,9 +154,9 @@
         return new BooleanUnaryExpression(left) {
             public Object evaluate(MessageEvaluationContext message) throws JMSException {
                 Object rvalue = right.evaluate(message);
-                if (rvalue == null) 
+                if (rvalue == null)
                     return null;
-                if (!rvalue.getClass().equals(Boolean.class)) 
+                if (!rvalue.getClass().equals(Boolean.class))
                     return Boolean.FALSE;
                 return ((Boolean)rvalue).booleanValue() ? Boolean.TRUE : Boolean.FALSE;
             }
@@ -172,34 +172,32 @@
     }
 
     private static Number negate(Number left) {
-    	Class clazz = left.getClass();
+        Class clazz = left.getClass();
         if (clazz == Integer.class) {
             return new Integer(-left.intValue());
-        }
-        else if (clazz == Long.class) {
+        } else if (clazz == Long.class) {
             return new Long(-left.longValue());
-        }
-        else if (clazz ==  Float.class) {
+        } else if (clazz == Float.class) {
             return new Float(-left.floatValue());
-        }
-        else if (clazz == Double.class) {
+        } else if (clazz == Double.class) {
             return new Double(-left.doubleValue());
-        }
-        else if (clazz == BigDecimal.class) {
-        	// We ussually get a big deciamal when we have Long.MIN_VALUE constant in the 
-        	// Selector.  Long.MIN_VALUE is too big to store in a Long as a positive so we store it 
-        	// as a Big decimal.  But it gets Negated right away.. to here we try to covert it back
-        	// to a Long.        	
-        	BigDecimal bd = (BigDecimal)left;
-        	bd = bd.negate();
-        	
-        	if( BD_LONG_MIN_VALUE.compareTo(bd)==0  ) {
-        		return Long.valueOf(Long.MIN_VALUE);
-        	}
+        } else if (clazz == BigDecimal.class) {
+            // We ussually get a big deciamal when we have Long.MIN_VALUE
+            // constant in the
+            // Selector. Long.MIN_VALUE is too big to store in a Long as a
+            // positive so we store it
+            // as a Big decimal. But it gets Negated right away.. to here we try
+            // to covert it back
+            // to a Long.
+            BigDecimal bd = (BigDecimal)left;
+            bd = bd.negate();
+
+            if (BD_LONG_MIN_VALUE.compareTo(bd) == 0) {
+                return Long.valueOf(Long.MIN_VALUE);
+            }
             return bd;
-        }
-        else {
-            throw new RuntimeException("Don't know how to negate: "+left);
+        } else {
+            throw new RuntimeException("Don't know how to negate: " + left);
         }
     }
 
@@ -224,7 +222,7 @@
 
     /**
      * TODO: more efficient hashCode()
-     *
+     * 
      * @see java.lang.Object#hashCode()
      */
     public int hashCode() {
@@ -233,7 +231,7 @@
 
     /**
      * TODO: more efficient hashCode()
-     *
+     * 
      * @see java.lang.Object#equals(java.lang.Object)
      */
     public boolean equals(Object o) {
@@ -246,9 +244,9 @@
     }
 
     /**
-     * Returns the symbol that represents this binary expression.  For example, addition is
-     * represented by "+"
-     *
+     * Returns the symbol that represents this binary expression. For example,
+     * addition is represented by "+"
+     * 
      * @return
      */
     abstract public String getExpressionSymbol();

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/filter/XPathExpression.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/filter/XPathExpression.java?view=diff&rev=563982&r1=563981&r2=563982
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/filter/XPathExpression.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/filter/XPathExpression.java Wed Aug  8 11:56:59 2007
@@ -34,23 +34,24 @@
 
     private static final Log log = LogFactory.getLog(XPathExpression.class);
     private static final String EVALUATOR_SYSTEM_PROPERTY = "org.apache.activemq.XPathEvaluatorClassName";
-    private static final String DEFAULT_EVALUATOR_CLASS_NAME=XalanXPathEvaluator.class.getName();
-    
+    private static final String DEFAULT_EVALUATOR_CLASS_NAME = XalanXPathEvaluator.class.getName();
+
     private static final Constructor EVALUATOR_CONSTRUCTOR;
-    
+
     static {
-        String cn = System.getProperty(EVALUATOR_SYSTEM_PROPERTY, DEFAULT_EVALUATOR_CLASS_NAME);        
+        String cn = System.getProperty(EVALUATOR_SYSTEM_PROPERTY, DEFAULT_EVALUATOR_CLASS_NAME);
         Constructor m = null;
         try {
             try {
                 m = getXPathEvaluatorConstructor(cn);
             } catch (Throwable e) {
-                log.warn("Invalid "+XPathEvaluator.class.getName()+" implementation: "+cn+", reason: "+e,e);
+                log.warn("Invalid " + XPathEvaluator.class.getName() + " implementation: " + cn
+                         + ", reason: " + e, e);
                 cn = DEFAULT_EVALUATOR_CLASS_NAME;
                 try {
                     m = getXPathEvaluatorConstructor(cn);
                 } catch (Throwable e2) {
-                    log.error("Default XPath evaluator could not be loaded",e);
+                    log.error("Default XPath evaluator could not be loaded", e);
                 }
             }
         } finally {
@@ -58,21 +59,22 @@
         }
     }
 
-    private static Constructor getXPathEvaluatorConstructor(String cn) throws ClassNotFoundException, SecurityException, NoSuchMethodException {
+    private static Constructor getXPathEvaluatorConstructor(String cn) throws ClassNotFoundException,
+        SecurityException, NoSuchMethodException {
         Class c = XPathExpression.class.getClassLoader().loadClass(cn);
-        if( !XPathEvaluator.class.isAssignableFrom(c) ) {
-            throw new ClassCastException(""+c+" is not an instance of "+XPathEvaluator.class);
+        if (!XPathEvaluator.class.isAssignableFrom(c)) {
+            throw new ClassCastException("" + c + " is not an instance of " + XPathEvaluator.class);
         }
-        return c.getConstructor(new Class[]{String.class});
+        return c.getConstructor(new Class[] {String.class});
     }
-    
+
     private final String xpath;
     private final XPathEvaluator evaluator;
-    
+
     static public interface XPathEvaluator {
         public boolean evaluate(Message message) throws JMSException;
-    }    
-    
+    }
+
     XPathExpression(String xpath) {
         this.xpath = xpath;
         this.evaluator = createEvaluator(xpath);
@@ -80,21 +82,21 @@
 
     private XPathEvaluator createEvaluator(String xpath2) {
         try {
-            return (XPathEvaluator)EVALUATOR_CONSTRUCTOR.newInstance(new Object[]{xpath});
+            return (XPathEvaluator)EVALUATOR_CONSTRUCTOR.newInstance(new Object[] {xpath});
         } catch (InvocationTargetException e) {
             Throwable cause = e.getCause();
-            if( cause instanceof RuntimeException ) {
+            if (cause instanceof RuntimeException) {
                 throw (RuntimeException)cause;
             }
-            throw new RuntimeException("Invalid XPath Expression: "+xpath+" reason: "+e.getMessage(), e);
+            throw new RuntimeException("Invalid XPath Expression: " + xpath + " reason: " + e.getMessage(), e);
         } catch (Throwable e) {
-            throw new RuntimeException("Invalid XPath Expression: "+xpath+" reason: "+e.getMessage(), e);
+            throw new RuntimeException("Invalid XPath Expression: " + xpath + " reason: " + e.getMessage(), e);
         }
     }
 
     public Object evaluate(MessageEvaluationContext message) throws JMSException {
         try {
-            if( message.isDropped() )
+            if (message.isDropped())
                 return null;
             return evaluator.evaluate(message.getMessage()) ? Boolean.TRUE : Boolean.FALSE;
         } catch (IOException e) {
@@ -104,9 +106,9 @@
     }
 
     public String toString() {
-        return "XPATH "+ConstantExpression.encodeString(xpath);
+        return "XPATH " + ConstantExpression.encodeString(xpath);
     }
-    
+
     /**
      * @param message
      * @return true if the expression evaluates to Boolean.TRUE.
@@ -114,7 +116,7 @@
      */
     public boolean matches(MessageEvaluationContext message) throws JMSException {
         Object object = evaluate(message);
-        return object!=null && object==Boolean.TRUE;            
+        return object != null && object == Boolean.TRUE;
     }
 
 }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/filter/XQueryExpression.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/filter/XQueryExpression.java?view=diff&rev=563982&r1=563981&r2=563982
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/filter/XQueryExpression.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/filter/XQueryExpression.java Wed Aug  8 11:56:59 2007
@@ -34,9 +34,9 @@
     }
 
     public String toString() {
-        return "XQUERY "+ConstantExpression.encodeString(xpath);
+        return "XQUERY " + ConstantExpression.encodeString(xpath);
     }
-    
+
     /**
      * @param message
      * @return true if the expression evaluates to Boolean.TRUE.
@@ -44,7 +44,7 @@
      */
     public boolean matches(MessageEvaluationContext message) throws JMSException {
         Object object = evaluate(message);
-        return object!=null && object==Boolean.TRUE;            
+        return object != null && object == Boolean.TRUE;
     }
 
 }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/filter/XalanXPathEvaluator.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/filter/XalanXPathEvaluator.java?view=diff&rev=563982&r1=563981&r2=563982
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/filter/XalanXPathEvaluator.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/filter/XalanXPathEvaluator.java Wed Aug  8 11:56:59 2007
@@ -33,40 +33,40 @@
 import org.xml.sax.InputSource;
 
 public class XalanXPathEvaluator implements XPathExpression.XPathEvaluator {
-    
+
     private final String xpath;
 
     public XalanXPathEvaluator(String xpath) {
         this.xpath = xpath;
     }
-    
+
     public boolean evaluate(Message m) throws JMSException {
-        if( m instanceof TextMessage ) {
+        if (m instanceof TextMessage) {
             String text = ((TextMessage)m).getText();
-            return evaluate(text);                
-        } else if ( m instanceof BytesMessage ) {
-            BytesMessage bm = (BytesMessage) m;
-            byte data[] = new byte[(int) bm.getBodyLength()];
+            return evaluate(text);
+        } else if (m instanceof BytesMessage) {
+            BytesMessage bm = (BytesMessage)m;
+            byte data[] = new byte[(int)bm.getBodyLength()];
             bm.readBytes(data);
             return evaluate(data);
-        }            
+        }
         return false;
     }
 
     private boolean evaluate(byte[] data) {
         try {
-            
+
             InputSource inputSource = new InputSource(new ByteArrayInputStream(data));
-            
+
             DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
             factory.setNamespaceAware(true);
             DocumentBuilder dbuilder = factory.newDocumentBuilder();
             Document doc = dbuilder.parse(inputSource);
-            
+
             CachedXPathAPI cachedXPathAPI = new CachedXPathAPI();
-            NodeIterator iterator = cachedXPathAPI.selectNodeIterator(doc,xpath);
-            return iterator.nextNode()!=null;
-            
+            NodeIterator iterator = cachedXPathAPI.selectNodeIterator(doc, xpath);
+            return iterator.nextNode() != null;
+
         } catch (Throwable e) {
             return false;
         }
@@ -75,17 +75,18 @@
     private boolean evaluate(String text) {
         try {
             InputSource inputSource = new InputSource(new StringReader(text));
-            
+
             DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
             factory.setNamespaceAware(true);
             DocumentBuilder dbuilder = factory.newDocumentBuilder();
             Document doc = dbuilder.parse(inputSource);
-            
-            // We should associated the cachedXPathAPI object with the message being evaluated
+
+            // We should associated the cachedXPathAPI object with the message
+            // being evaluated
             // since that should speedup subsequent xpath expressions.
             CachedXPathAPI cachedXPathAPI = new CachedXPathAPI();
-            NodeIterator iterator = cachedXPathAPI.selectNodeIterator(doc,xpath);
-            return iterator.nextNode()!=null;
+            NodeIterator iterator = cachedXPathAPI.selectNodeIterator(doc, xpath);
+            return iterator.nextNode() != null;
         } catch (Throwable e) {
             return false;
         }



Mime
View raw message