diff options
| author | Robert Godfrey <rgodfrey@apache.org = rgodfrey = Robert Godfrey rgodfrey@apache.org@apache.org> | 2014-04-11 21:24:55 +0000 |
|---|---|---|
| committer | Robert Godfrey <rgodfrey@apache.org = rgodfrey = Robert Godfrey rgodfrey@apache.org@apache.org> | 2014-04-11 21:24:55 +0000 |
| commit | 7b703586794bc1e56188f97aca697bd278fc9745 (patch) | |
| tree | 1fd5db95f2751171a11d945fe90eb6fc6cbb88c2 /qpid/java/broker-plugins | |
| parent | 3cc083e2d3509d0bb2806f5d36b8e8ffc74e25db (diff) | |
| download | qpid-python-7b703586794bc1e56188f97aca697bd278fc9745.tar.gz | |
QPID-5673 : [Java Broker] Check the virtual host has been found before attempting to register the connection with the virtual host
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1586780 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/broker-plugins')
| -rw-r--r-- | qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Connection_1_0.java | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Connection_1_0.java b/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Connection_1_0.java index ddd88a0df8..4c272e929f 100644 --- a/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Connection_1_0.java +++ b/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Connection_1_0.java @@ -134,7 +134,6 @@ public class Connection_1_0 implements ConnectionEventListener, AMQConnectionMod host = _broker.getDefaultVirtualHost(); } _vhost = _broker.getVirtualHostRegistry().getVirtualHost(host); - _vhost.getConnectionRegistry().registerConnection(this); if(_vhost == null) { @@ -143,11 +142,14 @@ public class Connection_1_0 implements ConnectionEventListener, AMQConnectionMod err.setDescription("Unknown hostname " + _conn.getLocalHostname()); _conn.close(err); } - Subject authSubject = _subjectCreator.createSubjectWithGroups(_conn.getUser()); - _subject.getPrincipals().addAll(authSubject.getPrincipals()); - _subject.getPublicCredentials().addAll(authSubject.getPublicCredentials()); - _subject.getPrivateCredentials().addAll(authSubject.getPrivateCredentials()); - + else + { + _vhost.getConnectionRegistry().registerConnection(this); + Subject authSubject = _subjectCreator.createSubjectWithGroups(_conn.getUser()); + _subject.getPrincipals().addAll(authSubject.getPrincipals()); + _subject.getPublicCredentials().addAll(authSubject.getPublicCredentials()); + _subject.getPrivateCredentials().addAll(authSubject.getPrivateCredentials()); + } } public void remoteSessionCreation(SessionEndpoint endpoint) @@ -218,7 +220,10 @@ public class Connection_1_0 implements ConnectionEventListener, AMQConnectionMod { _closeTasks.clear(); } - _vhost.getConnectionRegistry().deregisterConnection(this); + if(_vhost != null) + { + _vhost.getConnectionRegistry().deregisterConnection(this); + } } |
