fixed MessageListenerAdapter's "getSubscriptionName()" to work without delegate as well (SPR-5309)

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@627 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
Juergen Hoeller 2009-02-13 09:15:43 +00:00
parent 1cf413bd2e
commit 06451988d6
1 changed files with 5 additions and 5 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2008 the original author or authors.
* Copyright 2002-2009 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -17,7 +17,6 @@
package org.springframework.jms.listener.adapter;
import java.lang.reflect.InvocationTargetException;
import javax.jms.Destination;
import javax.jms.InvalidDestinationException;
import javax.jms.JMSException;
@ -366,11 +365,12 @@ public class MessageListenerAdapter implements MessageListener, SessionAwareMess
}
public String getSubscriptionName() {
if (this.delegate instanceof SubscriptionNameProvider) {
return ((SubscriptionNameProvider) this.delegate).getSubscriptionName();
Object delegate = getDelegate();
if (delegate != this && delegate instanceof SubscriptionNameProvider) {
return ((SubscriptionNameProvider) delegate).getSubscriptionName();
}
else {
return this.delegate.getClass().getName();
return delegate.getClass().getName();
}
}