You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Thomas Günter (JIRA)" <ji...@apache.org> on 2014/06/01 21:46:02 UTC

[jira] [Closed] (AMQ-4507) FailoverTransport throws NullPointerException

     [ https://issues.apache.org/jira/browse/AMQ-4507?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thomas Günter closed AMQ-4507.
------------------------------


Verified a long time ago, but missed to close it.

> FailoverTransport throws NullPointerException
> ---------------------------------------------
>
>                 Key: AMQ-4507
>                 URL: https://issues.apache.org/jira/browse/AMQ-4507
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Transport
>    Affects Versions: 5.8.0
>         Environment: Win 7, java 7
>            Reporter: Thomas Günter
>            Assignee: Gary Tully
>            Priority: Minor
>              Labels: patch
>             Fix For: 5.9.0
>
>
> The Failovertransport throws NullPointer Exceptions in case of a failover to another primary host for the following broker url:
> {{failover:(tcp://primary_1:61616,tcp://primary_2:61616,tcp://secondary_1:61616,tcp://secondary_2:61616)?randomize=false&priorityBackup=true&priorityURIs=tcp://primary_1:61616,tcp://primary_2:61616&jms.alwaysSyncSend=true}}
> Stack trace:
> Exception in thread "ActiveMQ Task-2" java.lang.NullPointerException
> 	at org.apache.activemq.transport.failover.FailoverTransport.disposeTransport(FailoverTransport.java:231)
> 	at org.apache.activemq.transport.failover.FailoverTransport.doReconnect(FailoverTransport.java:954)
> 	at org.apache.activemq.transport.failover.FailoverTransport$2.iterate(FailoverTransport.java:143)
> 	at org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:129)
> 	at org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:47)
> 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
> 	at java.lang.Thread.run(Thread.java:722)
> I assume that this is a copy-paste bug, since in the current revision (1478184, see link below) of the FailoverTransport on line #966, the variable 'old' should be checked for null instead of 'transport'. However, I have no clue why 'old' is null even though the transport was handling messages before the failover.
> [http://svn.apache.org/viewvc/activemq/trunk/activemq-client/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java?revision=1478184&view=markup]
> Current code:
> 955 Transport old = this.connectedTransport.getAndSet(null);
> 966 if (transport != null) \{
> 967   disposeTransport(old);
> 968 \}
> Corrected code:
> 955 Transport old = this.connectedTransport.getAndSet(null);
> 966 if (old!= null) \{
> 967   disposeTransport(old);
> 968 \}



--
This message was sent by Atlassian JIRA
(v6.2#6252)