summaryrefslogtreecommitdiff
path: root/java/client/src
diff options
context:
space:
mode:
authorMartin Ritchie <ritchiem@apache.org>2008-08-07 15:50:28 +0000
committerMartin Ritchie <ritchiem@apache.org>2008-08-07 15:50:28 +0000
commit06e4488afee377347660ea481959dfbfb720ab47 (patch)
tree9d7a107a6555d1aca49da0bbb62568025b6cc1ca /java/client/src
parentc53cf3df85bb5a37ec7ec000667cba4012c35e85 (diff)
downloadqpid-python-06e4488afee377347660ea481959dfbfb720ab47.tar.gz
QPID-1182 : Some of the NullPointerExceptions from the SimpleACLTest are due to the close and the notification overlapping due to the lack of locking. The problem is that the AtomicBoolean _closed is used for control but the AMQSession.checkNotClosed needs to check _closed and then throw any exception in the StateManager. However, in a loop of the SimpleACLTest, I would see _closed == false but then it is set right afterwards but the option to check AMQStateManager and throw the exception is past and the super.Closeable.checkNotClosed is called and throws the JMSException with no linked exception hence the test throws NullPointerException
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@683635 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/client/src')
-rw-r--r--java/client/src/main/java/org/apache/qpid/client/AMQSession.java21
1 files changed, 14 insertions, 7 deletions
diff --git a/java/client/src/main/java/org/apache/qpid/client/AMQSession.java b/java/client/src/main/java/org/apache/qpid/client/AMQSession.java
index c253b8b641..d2ef457c94 100644
--- a/java/client/src/main/java/org/apache/qpid/client/AMQSession.java
+++ b/java/client/src/main/java/org/apache/qpid/client/AMQSession.java
@@ -494,15 +494,22 @@ public abstract class AMQSession extends Closeable implements Session, QueueSess
public void checkNotClosed() throws JMSException
{
- // if the Connection has closed then we should throw any exception that has occured that we were not waiting for
- AMQStateManager manager = _connection.getProtocolHandler().getStateManager();
- if (isClosed() && manager.getCurrentState().equals(AMQState.CONNECTION_CLOSED) && manager.getLastException() != null)
+ try
{
- JMSException jmse = new IllegalStateException("Object " + toString() + " has been closed");
- jmse.setLinkedException(manager.getLastException());
- throw jmse;
+ super.checkNotClosed();
+ }
+ catch (IllegalStateException ise)
+ {
+ // if the Connection has closed then we should throw any exception that has occured that we were not waiting for
+ AMQStateManager manager = _connection.getProtocolHandler().getStateManager();
+
+ if (manager.getCurrentState().equals(AMQState.CONNECTION_CLOSED) && manager.getLastException() != null)
+ {
+ ise.setLinkedException(manager.getLastException());
+ }
+
+ throw ise;
}
- super.checkNotClosed();
}
public BytesMessage createBytesMessage() throws JMSException