[ 
https://issues.apache.org/jira/browse/AMQ-5954?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15256544#comment-15256544
 ] 

ASF subversion and git services commented on AMQ-5954:
------------------------------------------------------

Commit e996dbe7c28d928c701daef6b3afd5770ae4c2ed in activemq's branch 
refs/heads/master from [~tabish121]
[ https://git-wip-us.apache.org/repos/asf?p=activemq.git;h=e996dbe ]

https://issues.apache.org/jira/browse/AMQ-5954

Use a single destination transformation method instead of having to
different implementations.

> Fix for failing activeMq bridge 
> --------------------------------
>
>                 Key: AMQ-5954
>                 URL: https://issues.apache.org/jira/browse/AMQ-5954
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker
>    Affects Versions: 5.11.1
>            Reporter: Knut Skomedal
>             Fix For: 5.14.0
>
>
> We have a system using activeMQ and weblogic, where we found that after 
> upgrading weblogic server from 12.1.1 to 12.1.3 the bridge stopped working. 
> We've found the cause and fixed it (oracle refused to fix their code), and 
> would like you to add the fix to activemq so we can remove the local hack 
> we've made. Look for the "//new code" in the code sample furthest down in 
> this description
> Cause: Oracle changed the method getQueueName() in 
> weblogic.jms.common.DestinationImpl.java so that it returns null if the 
> object received is not the correct type (a Topic instead of a Queue for 
> instance). In previous version the method returned the name regardless of 
> type. The missing name casues the bridge to fail. 
> The object received in our case is an implementation of the Destination 
> interface, DistributedDestinationImpl, which implements both these interfaces 
> in its parent class DestinationImpl. In 
> org.apache.activemq.ActiveMQMessageTransformation.transformDestination(...) 
> where the instanceof TemporaryQueue/TemporaryTopic++ tests will always return 
> true for both TemporaryQueue and TemporaryTopic. The code will enter the 
> first if() in the code below because of this and call the getQueueName() 
> method even if it is a Topic, and will return null.  
> ActiveMQMessageTransformation.java (old version): 
> {code}
>     public static ActiveMQDestination transformDestination(Destination 
> destination) throws JMSException {
>         ActiveMQDestination activeMQDestination = null;
>         if (destination != null) {
>             if (destination instanceof ActiveMQDestination) {
>                 return (ActiveMQDestination)destination;
>             } else {
>                 if (destination instanceof TemporaryQueue) {
>                     activeMQDestination = new 
> ActiveMQTempQueue(((Queue)destination).getQueueName());
>                 } else if (destination instanceof TemporaryTopic) {
>                     activeMQDestination = new 
> ActiveMQTempTopic(((Topic)destination).getTopicName());
>                 } else if (destination instanceof Queue) {
>                     activeMQDestination = new 
> ActiveMQQueue(((Queue)destination).getQueueName());
>                 } else if (destination instanceof Topic) {
>                     activeMQDestination = new 
> ActiveMQTopic(((Topic)destination).getTopicName());
>                 }
>             }
>         }
>         return activeMQDestination;
>     }
> {code}
> The fixed version test for this case and calls the 
> UnresolvableDestinationTransformer which was added to activemq as a response 
> to issue AMQ-3401: 
> {code}
>     public static ActiveMQDestination transformDestination(Destination 
> destination) throws JMSException {
>         ActiveMQDestination activeMQDestination = null;
>         if (destination != null) {
>             if (destination instanceof ActiveMQDestination) {
>                 return (ActiveMQDestination)destination;
>             } else {
>                 //start new code
>                 if (destination instanceof TemporaryQueue && destination 
> instanceof TemporaryTopic) {
>                     activeMQDestination = 
> ActiveMQDestination.getUnresolvableDestinationTransformer().transform(destination);
>                 } else
>                 //end new code
>                 if (destination instanceof TemporaryQueue) {
>                     activeMQDestination = new 
> ActiveMQTempQueue(((Queue)destination).getQueueName());
>                 } else if (destination instanceof TemporaryTopic) {
>                     activeMQDestination = new 
> ActiveMQTempTopic(((Topic)destination).getTopicName());
>                 } else if (destination instanceof Queue) {
>                     activeMQDestination = new 
> ActiveMQQueue(((Queue)destination).getQueueName());
>                 } else if (destination instanceof Topic) {
>                     activeMQDestination = new 
> ActiveMQTopic(((Topic)destination).getTopicName());
>                 }
>             }
>         }
>         return activeMQDestination;
>     }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to