activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Susumu Moro <>
Subject NullPointerException occurs at ActiveMQConnection#close() (4.0RC3)
Date Mon, 17 Apr 2006 05:25:13 GMT


I found that NullPointerException will occur in ActiveMQConnection#Close().
Especially, the NullPointerException occurs at
ActiveMQConnection#syncSendPacket(Command,int) with
To reproduce the case, I wrote a simple JUnit testcase.
Is this case a bug or a feature?
Would anyone please check the case with the following JUnit testcase.

-- the JUnit TestCase --

package org.apache.activemq;


import javax.jms.JMSException;

import org.apache.activemq.command.ActiveMQMessage;
import org.apache.activemq.command.ActiveMQTextMessage;
import org.apache.activemq.command.Command;
import org.apache.activemq.command.ConnectionInfo;
import org.apache.activemq.command.Response;
import org.apache.activemq.openwire.CommandIdComparator;
import org.apache.activemq.transport.ResponseCorrelator;
import org.apache.activemq.transport.Transport;
import org.apache.activemq.transport.TransportSupport;
import org.apache.activemq.transport.mock.MockTransport;
import org.apache.activemq.transport.mock.MockTransportFactory;
import org.apache.activemq.util.ServiceStopper;
import org.omg.PortableInterceptor.ACTIVE;

import junit.framework.TestCase;

public class SyncSendTimeOutTest extends TestCase {
	public static void main(String[] args) {;
	private Transport mock;
	private Transport testTarget;
	private ActiveMQConnection connection;
	protected void setUp() throws Exception {
		// create new transport as mock object
		mock = new TransportSupport(){
			protected void doStop(ServiceStopper arg0) throws Exception {}
			protected void doStart() throws Exception {}
			public void oneway(Command cmd) throws IOException {
				// System.out.println(cmd);
				// only stop response of activemq message
				if( !(cmd instanceof ActiveMQMessage) && cmd.isResponseRequired() ){
					Response r = new Response();
					r.setCorrelationId( cmd.getCommandId() );
					getTransportListener().onCommand( r );
		// create new ResponseCorrelator transport for test
		testTarget = new ResponseCorrelator(mock);
		// create new ActiveMQConnection with responseCorrelator transport
		connection = new ActiveMQConnection( testTarget, new JMSStatsImpl() );
	public void testSyncSendWithTimeOut10Mill() throws Exception {
		try {
			connection.syncSendPacket( new ActiveMQTextMessage(), 10 );
		}catch( JMSException e ){
	public void testSyncSendWithTimeOut100Mill() throws Exception {
		try {
			connection.syncSendPacket( new ActiveMQTextMessage(), 100 );
		}catch( JMSException e ){}
	public void testSyncSendWithTimeOut1000Mill() throws Exception {
		try {
			connection.syncSendPacket( new ActiveMQTextMessage(), 1000 );
		}catch( JMSException e ){}

-- end the JUnit TestCase --


Susumu MORO <>
Open Source Software Development Center, NTT DATA CORPORATION

View this message in context:
Sent from the ActiveMQ - User forum at

View raw message