Skip to content

Commit

Permalink
remove NPE by always calling getChannel().getServerAdaptor(). Solves f…
Browse files Browse the repository at this point in the history
  • Loading branch information
zapodot committed Apr 25, 2013
1 parent d2995dd commit 183138d
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicBoolean;

Expand Down Expand Up @@ -52,7 +51,6 @@ public class StompJmsSession implements Session, QueueSession, TopicSession, Sto
LinkedBlockingQueue<StompJmsMessage> stoppedMessages = new LinkedBlockingQueue<StompJmsMessage>(10000);
StompChannel channel;
StompJmsPrefetch prefetch;
StompServerAdaptor serverAdaptor;

/**
* Constructor
Expand Down Expand Up @@ -565,7 +563,7 @@ public Queue createQueue(String queueName) throws JMSException {
*/
public TemporaryQueue createTemporaryQueue() throws JMSException {
checkClosed();
return serverAdaptor.createTemporaryQueue(this);
return getChannel().getServerAdaptor().createTemporaryQueue(this);
}

/**
Expand All @@ -575,7 +573,7 @@ public TemporaryQueue createTemporaryQueue() throws JMSException {
*/
public TemporaryTopic createTemporaryTopic() throws JMSException {
checkClosed();
return serverAdaptor.createTemporaryTopic(this);
return getChannel().getServerAdaptor().createTemporaryTopic(this);
}

/**
Expand Down Expand Up @@ -773,7 +771,6 @@ protected void start() throws JMSException {
protected StompChannel getChannel() throws JMSException {
if(this.channel == null) {
this.channel = this.connection.createChannel(this);
this.serverAdaptor = this.channel.getServerAdaptor();
}
return this.channel;
}
Expand Down

0 comments on commit 183138d

Please sign in to comment.