Skip to content

Commit 2674b13

Browse files
committed
fixed MessageListenerAdapter's "getSubscriptionName()" to work without delegate as well (SPR-5309)
1 parent 796392d commit 2674b13

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

org.springframework.jms/src/main/java/org/springframework/jms/listener/adapter/MessageListenerAdapter.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2008 the original author or authors.
2+
* Copyright 2002-2009 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -17,7 +17,6 @@
1717
package org.springframework.jms.listener.adapter;
1818

1919
import java.lang.reflect.InvocationTargetException;
20-
2120
import javax.jms.Destination;
2221
import javax.jms.InvalidDestinationException;
2322
import javax.jms.JMSException;
@@ -366,11 +365,12 @@ else if (!(delegate instanceof MessageListener)) {
366365
}
367366

368367
public String getSubscriptionName() {
369-
if (this.delegate instanceof SubscriptionNameProvider) {
370-
return ((SubscriptionNameProvider) this.delegate).getSubscriptionName();
368+
Object delegate = getDelegate();
369+
if (delegate != this && delegate instanceof SubscriptionNameProvider) {
370+
return ((SubscriptionNameProvider) delegate).getSubscriptionName();
371371
}
372372
else {
373-
return this.delegate.getClass().getName();
373+
return delegate.getClass().getName();
374374
}
375375
}
376376

0 commit comments

Comments
 (0)