You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Niklas Gustavsson (Commented) (JIRA)" <ji...@apache.org> on 2011/12/27 23:16:30 UTC

[jira] [Commented] (VYSPER-301) NamespaceHandlerDictionary does not recognize IQ error stanza namespaces

    [ https://issues.apache.org/jira/browse/VYSPER-301?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13176337#comment-13176337 ] 

Niklas Gustavsson commented on VYSPER-301:
------------------------------------------

Would the following diff solve the problem for you?


Index: server/core/src/main/java/org/apache/vysper/xmpp/protocol/NamespaceHandlerDictionary.java
===================================================================
--- server/core/src/main/java/org/apache/vysper/xmpp/protocol/NamespaceHandlerDictionary.java	(revision 1225015)
+++ server/core/src/main/java/org/apache/vysper/xmpp/protocol/NamespaceHandlerDictionary.java	(working copy)
@@ -53,12 +53,17 @@
     @Override
     public StanzaHandler get(Stanza stanza) {
         String namespace;
-        if(stanza.getVerifier().subElementsPresentExact(1)) {
+        int noChilds = stanza.getInnerElements().size();
+        if(noChilds == 1) {
             namespace = stanza.getFirstInnerElement().getNamespaceURI();
+        } else if(noChilds == 2 && "error".equals(stanza.getAttributeValue("type"))) {
+            // rfc3920/9.3.2
+            // error stanza with original message as first child
+            namespace = stanza.getFirstInnerElement().getNamespaceURI();
         } else {
             namespace = stanza.getNamespaceURI();
         }
-        
+
         if(namespace != null && namespace.equals(namespaceURI)) {
             return super.get(stanza);
         } else {

                
> NamespaceHandlerDictionary does not recognize IQ error stanza namespaces
> ------------------------------------------------------------------------
>
>                 Key: VYSPER-301
>                 URL: https://issues.apache.org/jira/browse/VYSPER-301
>             Project: VYSPER
>          Issue Type: Bug
>          Components: stanza routing
>            Reporter: Mike Mahoney
>            Priority: Minor
>
> If an IQ error stanza contains the original sender XML then NamespaceHandlerDictionary.get() uses the IQ's namespace, instead of the original sender's namespace.  This prevents custom IQ handlers from ever being invoked.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira