This closes #432

This commit is contained in:
jbertram 2016-04-04 11:04:49 -05:00
commit d476ca1035
8 changed files with 41 additions and 60 deletions

View File

@ -473,7 +473,7 @@ public class ActiveMQSession implements QueueSession, TopicSession {
else { else {
localTopic = new ActiveMQTopic(topic.getTopicName()); localTopic = new ActiveMQTopic(topic.getTopicName());
} }
return internalCreateSharedConsumer(localTopic, name, messageSelector, ConsumerDurability.NON_DURABLE, true); return internalCreateSharedConsumer(localTopic, name, messageSelector, ConsumerDurability.NON_DURABLE);
} }
@Override @Override
@ -523,7 +523,7 @@ public class ActiveMQSession implements QueueSession, TopicSession {
else { else {
localTopic = new ActiveMQTopic(topic.getTopicName()); localTopic = new ActiveMQTopic(topic.getTopicName());
} }
return internalCreateSharedConsumer(localTopic, name, messageSelector, ConsumerDurability.DURABLE, true); return internalCreateSharedConsumer(localTopic, name, messageSelector, ConsumerDurability.DURABLE);
} }
enum ConsumerDurability { enum ConsumerDurability {
@ -536,8 +536,7 @@ public class ActiveMQSession implements QueueSession, TopicSession {
private ActiveMQMessageConsumer internalCreateSharedConsumer(final ActiveMQDestination dest, private ActiveMQMessageConsumer internalCreateSharedConsumer(final ActiveMQDestination dest,
final String subscriptionName, final String subscriptionName,
String selectorString, String selectorString,
ConsumerDurability durability, ConsumerDurability durability) throws JMSException {
final boolean shared) throws JMSException {
try { try {
if (dest.isQueue()) { if (dest.isQueue()) {

View File

@ -16,7 +16,6 @@
*/ */
package org.apache.activemq.artemis.core.protocol.stomp.v12; package org.apache.activemq.artemis.core.protocol.stomp.v12;
import org.apache.activemq.artemis.core.protocol.stomp.FrameEventListener;
import org.apache.activemq.artemis.core.protocol.stomp.ActiveMQStompException; import org.apache.activemq.artemis.core.protocol.stomp.ActiveMQStompException;
import org.apache.activemq.artemis.core.protocol.stomp.Stomp; import org.apache.activemq.artemis.core.protocol.stomp.Stomp;
import org.apache.activemq.artemis.core.protocol.stomp.StompConnection; import org.apache.activemq.artemis.core.protocol.stomp.StompConnection;
@ -30,7 +29,7 @@ import org.apache.activemq.artemis.core.server.ServerMessage;
import static org.apache.activemq.artemis.core.protocol.stomp.ActiveMQStompProtocolMessageBundle.BUNDLE; import static org.apache.activemq.artemis.core.protocol.stomp.ActiveMQStompProtocolMessageBundle.BUNDLE;
public class StompFrameHandlerV12 extends StompFrameHandlerV11 implements FrameEventListener { public class StompFrameHandlerV12 extends StompFrameHandlerV11 {
public StompFrameHandlerV12(StompConnection connection) { public StompFrameHandlerV12(StompConnection connection) {
super(connection); super(connection);

View File

@ -158,7 +158,7 @@ public abstract class ComparisonExpression extends BinaryExpression implements B
@Override @Override
public boolean matches(Filterable message) throws FilterException { public boolean matches(Filterable message) throws FilterException {
Object object = evaluate(message); Object object = evaluate(message);
return object != null && object == Boolean.TRUE; return object == Boolean.TRUE;
} }
} }
@ -392,19 +392,19 @@ public abstract class ComparisonExpression extends BinaryExpression implements B
} }
else if (lc == Byte.class) { else if (lc == Byte.class) {
if (rc == Short.class) { if (rc == Short.class) {
lv = Short.valueOf(((Number) lv).shortValue()); lv = ((Number) lv).shortValue();
} }
else if (rc == Integer.class) { else if (rc == Integer.class) {
lv = Integer.valueOf(((Number) lv).intValue()); lv = ((Number) lv).intValue();
} }
else if (rc == Long.class) { else if (rc == Long.class) {
lv = Long.valueOf(((Number) lv).longValue()); lv = ((Number) lv).longValue();
} }
else if (rc == Float.class) { else if (rc == Float.class) {
lv = new Float(((Number) lv).floatValue()); lv = ((Number) lv).floatValue();
} }
else if (rc == Double.class) { else if (rc == Double.class) {
lv = new Double(((Number) lv).doubleValue()); lv = ((Number) lv).doubleValue();
} }
else if (convertStringExpressions && rc == String.class) { else if (convertStringExpressions && rc == String.class) {
rv = Byte.valueOf((String) rv); rv = Byte.valueOf((String) rv);
@ -415,16 +415,16 @@ public abstract class ComparisonExpression extends BinaryExpression implements B
} }
else if (lc == Short.class) { else if (lc == Short.class) {
if (rc == Integer.class) { if (rc == Integer.class) {
lv = Integer.valueOf(((Number) lv).intValue()); lv = ((Number) lv).intValue();
} }
else if (rc == Long.class) { else if (rc == Long.class) {
lv = Long.valueOf(((Number) lv).longValue()); lv = ((Number) lv).longValue();
} }
else if (rc == Float.class) { else if (rc == Float.class) {
lv = new Float(((Number) lv).floatValue()); lv = ((Number) lv).floatValue();
} }
else if (rc == Double.class) { else if (rc == Double.class) {
lv = new Double(((Number) lv).doubleValue()); lv = ((Number) lv).doubleValue();
} }
else if (convertStringExpressions && rc == String.class) { else if (convertStringExpressions && rc == String.class) {
rv = Short.valueOf((String) rv); rv = Short.valueOf((String) rv);
@ -435,13 +435,13 @@ public abstract class ComparisonExpression extends BinaryExpression implements B
} }
else if (lc == Integer.class) { else if (lc == Integer.class) {
if (rc == Long.class) { if (rc == Long.class) {
lv = Long.valueOf(((Number) lv).longValue()); lv = ((Number) lv).longValue();
} }
else if (rc == Float.class) { else if (rc == Float.class) {
lv = new Float(((Number) lv).floatValue()); lv = ((Number) lv).floatValue();
} }
else if (rc == Double.class) { else if (rc == Double.class) {
lv = new Double(((Number) lv).doubleValue()); lv = ((Number) lv).doubleValue();
} }
else if (convertStringExpressions && rc == String.class) { else if (convertStringExpressions && rc == String.class) {
rv = Integer.valueOf((String) rv); rv = Integer.valueOf((String) rv);
@ -452,13 +452,13 @@ public abstract class ComparisonExpression extends BinaryExpression implements B
} }
else if (lc == Long.class) { else if (lc == Long.class) {
if (rc == Integer.class) { if (rc == Integer.class) {
rv = Long.valueOf(((Number) rv).longValue()); rv = ((Number) rv).longValue();
} }
else if (rc == Float.class) { else if (rc == Float.class) {
lv = new Float(((Number) lv).floatValue()); lv = ((Number) lv).floatValue();
} }
else if (rc == Double.class) { else if (rc == Double.class) {
lv = new Double(((Number) lv).doubleValue()); lv = ((Number) lv).doubleValue();
} }
else if (convertStringExpressions && rc == String.class) { else if (convertStringExpressions && rc == String.class) {
rv = Long.valueOf((String) rv); rv = Long.valueOf((String) rv);
@ -468,14 +468,11 @@ public abstract class ComparisonExpression extends BinaryExpression implements B
} }
} }
else if (lc == Float.class) { else if (lc == Float.class) {
if (rc == Integer.class) { if (rc == Integer.class || rc == Long.class) {
rv = new Float(((Number) rv).floatValue()); rv = ((Number) rv).floatValue();
}
else if (rc == Long.class) {
rv = new Float(((Number) rv).floatValue());
} }
else if (rc == Double.class) { else if (rc == Double.class) {
lv = new Double(((Number) lv).doubleValue()); lv = ((Number) lv).doubleValue();
} }
else if (convertStringExpressions && rc == String.class) { else if (convertStringExpressions && rc == String.class) {
rv = Float.valueOf((String) rv); rv = Float.valueOf((String) rv);
@ -485,14 +482,8 @@ public abstract class ComparisonExpression extends BinaryExpression implements B
} }
} }
else if (lc == Double.class) { else if (lc == Double.class) {
if (rc == Integer.class) { if (rc == Integer.class || rc == Long.class || rc == Float.class) {
rv = new Double(((Number) rv).doubleValue()); rv = ((Number) rv).doubleValue();
}
else if (rc == Long.class) {
rv = new Double(((Number) rv).doubleValue());
}
else if (rc == Float.class) {
rv = new Double(((Number) rv).doubleValue());
} }
else if (convertStringExpressions && rc == String.class) { else if (convertStringExpressions && rc == String.class) {
rv = Double.valueOf((String) rv); rv = Double.valueOf((String) rv);
@ -545,7 +536,7 @@ public abstract class ComparisonExpression extends BinaryExpression implements B
@Override @Override
public boolean matches(Filterable message) throws FilterException { public boolean matches(Filterable message) throws FilterException {
Object object = evaluate(message); Object object = evaluate(message);
return object != null && object == Boolean.TRUE; return object == Boolean.TRUE;
} }
} }

View File

@ -87,7 +87,7 @@ public abstract class LogicExpression extends BinaryExpression implements Boolea
@Override @Override
public boolean matches(Filterable message) throws FilterException { public boolean matches(Filterable message) throws FilterException {
Object object = evaluate(message); Object object = evaluate(message);
return object != null && object == Boolean.TRUE; return object == Boolean.TRUE;
} }
} }

View File

@ -86,13 +86,7 @@ public abstract class UnaryExpression implements Expression {
return null; return null;
} }
if ((inList != null && inList.contains(rvalue)) ^ not) { return (inList != null && inList.contains(rvalue)) ^ not;
return Boolean.TRUE;
}
else {
return Boolean.FALSE;
}
} }
@Override @Override
@ -138,7 +132,7 @@ public abstract class UnaryExpression implements Expression {
@Override @Override
public boolean matches(Filterable message) throws FilterException { public boolean matches(Filterable message) throws FilterException {
Object object = evaluate(message); Object object = evaluate(message);
return object != null && object == Boolean.TRUE; return object == Boolean.TRUE;
} }
} }
@ -150,7 +144,7 @@ public abstract class UnaryExpression implements Expression {
if (lvalue == null) { if (lvalue == null) {
return null; return null;
} }
return lvalue.booleanValue() ? Boolean.FALSE : Boolean.TRUE; return !lvalue.booleanValue();
} }
@Override @Override
@ -179,7 +173,7 @@ public abstract class UnaryExpression implements Expression {
if (!rvalue.getClass().equals(Boolean.class)) { if (!rvalue.getClass().equals(Boolean.class)) {
return Boolean.FALSE; return Boolean.FALSE;
} }
return ((Boolean) rvalue).booleanValue() ? Boolean.TRUE : Boolean.FALSE; return ((Boolean) rvalue).booleanValue();
} }
@Override @Override
@ -197,16 +191,16 @@ public abstract class UnaryExpression implements Expression {
private static Number negate(Number left) { private static Number negate(Number left) {
Class clazz = left.getClass(); Class clazz = left.getClass();
if (clazz == Integer.class) { if (clazz == Integer.class) {
return new Integer(-left.intValue()); return -left.intValue();
} }
else if (clazz == Long.class) { else if (clazz == Long.class) {
return new Long(-left.longValue()); return -left.longValue();
} }
else if (clazz == Float.class) { else if (clazz == Float.class) {
return new Float(-left.floatValue()); return -left.floatValue();
} }
else if (clazz == Double.class) { else if (clazz == Double.class) {
return new Double(-left.doubleValue()); return -left.doubleValue();
} }
else if (clazz == BigDecimal.class) { else if (clazz == BigDecimal.class) {
// We ussually get a big deciamal when we have Long.MIN_VALUE // We ussually get a big deciamal when we have Long.MIN_VALUE

View File

@ -77,7 +77,7 @@ public final class XPathExpression implements BooleanExpression {
@Override @Override
public boolean matches(Filterable message) throws FilterException { public boolean matches(Filterable message) throws FilterException {
Object object = evaluate(message); Object object = evaluate(message);
return object != null && object == Boolean.TRUE; return object == Boolean.TRUE;
} }
} }

View File

@ -46,7 +46,7 @@ public final class XQueryExpression implements BooleanExpression {
@Override @Override
public boolean matches(Filterable message) throws FilterException { public boolean matches(Filterable message) throws FilterException {
Object object = evaluate(message); Object object = evaluate(message);
return object != null && object == Boolean.TRUE; return object == Boolean.TRUE;
} }
} }

View File

@ -265,7 +265,6 @@ public final class BindingsImpl implements Bindings {
boolean routed = false; boolean routed = false;
if (!exclusiveBindings.isEmpty()) {
for (Binding binding : exclusiveBindings) { for (Binding binding : exclusiveBindings) {
if (binding.getFilter() == null || binding.getFilter().match(message)) { if (binding.getFilter() == null || binding.getFilter().match(message)) {
binding.getBindable().route(message, context); binding.getBindable().route(message, context);
@ -273,7 +272,6 @@ public final class BindingsImpl implements Bindings {
routed = true; routed = true;
} }
} }
}
if (!routed) { if (!routed) {
// Remove the ids now, in order to avoid double check // Remove the ids now, in order to avoid double check