Remove unnecessary null checks and assignments

This commit is contained in:
Ville Skyttä 2016-07-02 00:31:06 +03:00 committed by Clebert Suconic
parent c4ab15060a
commit 149216e8ec
6 changed files with 9 additions and 26 deletions

View File

@ -787,7 +787,6 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery
} }
catch (ActiveMQException e) { catch (ActiveMQException e) {
factory.close(); factory.close();
factory = null;
if (e.getType() == ActiveMQExceptionType.NOT_CONNECTED) { if (e.getType() == ActiveMQExceptionType.NOT_CONNECTED) {
attempts++; attempts++;
@ -813,9 +812,7 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery
// how the sendSubscription happens. // how the sendSubscription happens.
// in case this ever changes. // in case this ever changes.
if (topology != null && !factory.waitForTopology(callTimeout, TimeUnit.MILLISECONDS)) { if (topology != null && !factory.waitForTopology(callTimeout, TimeUnit.MILLISECONDS)) {
if (factory != null) {
factory.cleanup(); factory.cleanup();
}
throw ActiveMQClientMessageBundle.BUNDLE.connectionTimedOutOnReceiveTopology(discoveryGroup); throw ActiveMQClientMessageBundle.BUNDLE.connectionTimedOutOnReceiveTopology(discoveryGroup);
} }
@ -1647,21 +1644,19 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery
initialise(); initialise();
ClientSessionFactory csf = null;
createConnectors(); createConnectors();
try { try {
int retryNumber = 0; int retryNumber = 0;
while (csf == null && !isClosed()) { while (!isClosed()) {
retryNumber++; retryNumber++;
for (Connector conn : connectors) { for (Connector conn : connectors) {
if (logger.isDebugEnabled()) { if (logger.isDebugEnabled()) {
logger.debug(this + "::Submitting connect towards " + conn); logger.debug(this + "::Submitting connect towards " + conn);
} }
csf = conn.tryConnect(); ClientSessionFactory csf = conn.tryConnect();
if (csf != null) { if (csf != null) {
csf.getConnection().addFailureListener(new FailureListener() { csf.getConnection().addFailureListener(new FailureListener() {

View File

@ -102,9 +102,7 @@ public class XmlUtil {
XMLStreamReader reader = factory.createXMLStreamReader(new FileInputStream(configuration)); XMLStreamReader reader = factory.createXMLStreamReader(new FileInputStream(configuration));
if (props != null) {
reader = new PropertiesFilter(reader, props); reader = new PropertiesFilter(reader, props);
}
return clazz.cast(unmarshaller.unmarshal(reader)); return clazz.cast(unmarshaller.unmarshal(reader));
} }

View File

@ -176,9 +176,6 @@ public class JMSBridgeControlImpl extends StandardMBean implements JMSBridgeCont
if (mode != null) { if (mode != null) {
bridge.setQualityOfServiceMode(QualityOfServiceMode.valueOf(mode)); bridge.setQualityOfServiceMode(QualityOfServiceMode.valueOf(mode));
} }
else {
mode = null;
}
} }
@Override @Override

View File

@ -1523,7 +1523,6 @@ public final class JMSBridgeImpl implements JMSBridge {
targetProducer.send(targetDestination, msg, msg.getJMSDeliveryMode(), msg.getJMSPriority(), timeToLive); targetProducer.send(targetDestination, msg, msg.getJMSDeliveryMode(), msg.getJMSPriority(), timeToLive);
if (msg != null)
messageCount++; messageCount++;
if (JMSBridgeImpl.trace) { if (JMSBridgeImpl.trace) {
ActiveMQJMSBridgeLogger.LOGGER.trace("Sent message " + msg); ActiveMQJMSBridgeLogger.LOGGER.trace("Sent message " + msg);

View File

@ -148,7 +148,6 @@ public class JMSMappingOutboundTransformer extends OutboundTransformer {
String msgId = msg.getJMSMessageID(); String msgId = msg.getJMSMessageID();
if (msgId != null) {
try { try {
props.setMessageId(AMQPMessageIdHelper.INSTANCE.toIdObject(msgId)); props.setMessageId(AMQPMessageIdHelper.INSTANCE.toIdObject(msgId));
} }
@ -156,10 +155,6 @@ public class JMSMappingOutboundTransformer extends OutboundTransformer {
props.setMessageId(msgId); props.setMessageId(msgId);
} }
} }
else {
props.setMessageId(msgId.toString());
}
}
if (msg.getJMSDestination() != null) { if (msg.getJMSDestination() != null) {
props.setTo(vendor.toAddress(msg.getJMSDestination())); props.setTo(vendor.toAddress(msg.getJMSDestination()));
if (maMap == null) { if (maMap == null) {

View File

@ -64,7 +64,6 @@ public class SecurityExample {
} }
// Step 5. bill tries to make a connection using wrong password // Step 5. bill tries to make a connection using wrong password
billConnection = null;
try { try {
billConnection = createConnection("bill", "activemq1", cf); billConnection = createConnection("bill", "activemq1", cf);
result = false; result = false;