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

Thomas Günter updated AMQ-4507:
-------------------------------

    Description: 
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 }


  was:The Failovertransport throws NullPointer Exceptions in case of a failover 
to another primary host for the following broker url:

    
> 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
>            Priority: Minor
>              Labels: patch
>
> 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 is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to