You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by be...@apache.org on 2009/08/24 10:32:11 UTC

svn commit: r807118 - /mina/sandbox/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/modules/core/base/handler/MessageHandler.java

Author: berndf
Date: Mon Aug 24 08:32:11 2009
New Revision: 807118

URL: http://svn.apache.org/viewvc?rev=807118&view=rev
Log:
cover potential error case with exception

Modified:
    mina/sandbox/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/modules/core/base/handler/MessageHandler.java

Modified: mina/sandbox/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/modules/core/base/handler/MessageHandler.java
URL: http://svn.apache.org/viewvc/mina/sandbox/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/modules/core/base/handler/MessageHandler.java?rev=807118&r1=807117&r2=807118&view=diff
==============================================================================
--- mina/sandbox/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/modules/core/base/handler/MessageHandler.java (original)
+++ mina/sandbox/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/modules/core/base/handler/MessageHandler.java Mon Aug 24 08:32:11 2009
@@ -97,7 +97,9 @@
             Entity from = stanza.getFrom();
             if (from == null || !from.isResourceSet()) {
                 // rewrite stanza with new from
-                from = new EntityImpl(sessionContext.getInitiatingEntity(), serverRuntimeContext.getResourceRegistry().getUniqueResourceForSession(sessionContext));
+                String resource = serverRuntimeContext.getResourceRegistry().getUniqueResourceForSession(sessionContext);
+                if (resource == null) throw new IllegalStateException("could not determine unique resource");
+                from = new EntityImpl(sessionContext.getInitiatingEntity(), resource);
                 StanzaBuilder stanzaBuilder = new StanzaBuilder(stanza.getName());
                 for (Attribute attribute : stanza.getAttributes()) {
                     if ("from".equals(attribute.getName())) continue;