Source:
<code>public Connection createConnection(String userName, String password) throws JMSException { Connection connection = null; try { if (JMSConstants.JMS_SPEC_VERSION_1_1.equals(jmsSpec)) { if (JMSConstants.JMSDestinationType.QUEUE.equals(this.destinationType)) { connection = ((QueueConnectionFactory) (this.connectionFactory)) .createQueueConnection(userName, password); } else if (JMSConstants.JMSDestinationType.TOPIC.equals(this.destinationType)) { connection = ((TopicConnectionFactory) (this.connectionFactory)) .createTopicConnection(userName, password); if (isDurable) { connection.setClientID(clientId); } } return connection; } else { QueueConnectionFactory qConFac = null; TopicConnectionFactory tConFac = null; if (JMSConstants.JMSDestinationType.QUEUE.equals(this.destinationType)) { qConFac = (QueueConnectionFactory) this.connectionFactory; } else { tConFac = (TopicConnectionFactory) this.connectionFactory; } if (null != qConFac) { connection = qConFac.createQueueConnection(userName, password); } else if (null != tConFac) { connection = tConFac.createTopicConnection(userName, password); } if (isDurable && !isSharedSubscription) { <START> if (connection != null) { <END> connection.setClientID(clientId); } else { throw new JMSException("Connection is null. Cannot set client ID " + clientId + "for durable subscription"); } } return connection; } } catch (JMSException e) { if (null != connection) { try { connection.close(); } catch (Exception ex) { logger.error("Error while closing the connection", ex); } } throw e; } }</code><technical_language>do this? check connection is null throw error there. Else, call setClientID method ? Basically, reverse if condition remove else part</technical_language>

Target:
public Connection createConnection(String userName, String password) throws JMSException { Connection connection = null; try { if (JMSConstants.JMS_SPEC_VERSION_1_1.equals(jmsSpec)) { if (JMSConstants.JMSDestinationType.QUEUE.equals(this.destinationType)) { connection = ((QueueConnectionFactory) (this.connectionFactory)) .createQueueConnection(userName, password); } else if (JMSConstants.JMSDestinationType.TOPIC.equals(this.destinationType)) { connection = ((TopicConnectionFactory) (this.connectionFactory)) .createTopicConnection(userName, password); if (isDurable) { connection.setClientID(clientId); } } return connection; } else { QueueConnectionFactory qConFac = null; TopicConnectionFactory tConFac = null; if (JMSConstants.JMSDestinationType.QUEUE.equals(this.destinationType)) { qConFac = (QueueConnectionFactory) this.connectionFactory; } else { tConFac = (TopicConnectionFactory) this.connectionFactory; } if (null != qConFac) { connection = qConFac.createQueueConnection(userName, password); } else if (null != tConFac) { connection = tConFac.createTopicConnection(userName, password); } if (isDurable && !isSharedSubscription) { if (connection == null) { throw new JMSException( "Connection is null. Cannot set client ID " + clientId + "for durable subscription"); } connection.setClientID(clientId); } return connection; } } catch (JMSException e) { if (null != connection) { try { connection.close(); } catch (Exception ex) { logger.error("Error while closing the connection", ex); } } throw e; } }