You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Johan Pramming (Jira)" <ji...@apache.org> on 2019/11/19 23:04:00 UTC

[jira] [Updated] (CAMEL-14194) Invalid JID is generated for private chat in XMPP component

     [ https://issues.apache.org/jira/browse/CAMEL-14194?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Johan Pramming updated CAMEL-14194:
-----------------------------------
    Description: 
An invalid JID, containing non-LDH characters, is created for the receiver (participant) when a private chat is started. As a result it is not possible to send chat messages directly to an user.

Group chats are not affected by the issue.

See: [https://stackoverflow.com/questions/58168566/problem-sending-messages-from-camel-xmpp-jid-malformed]

 

Exception seen in Openfire (4.4.3): 
{code:java}
java.lang.IllegalArgumentException: The input 'xxxx.xxx.xx@chat:xxxxx@xxxx.xxx.xx:camel' is not a valid JID domain part: Contains non-LDH characters.
{code}
 

The issue can be fixed by removing the thread name when the JID is created: 
{code:java}
diff --git a/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppPrivateChatProducer.java b/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppPrivateChatProducer.java
index b1b30a117ed..6eb1b9cb59c 100644
--- a/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppPrivateChatProducer.java
+++ b/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppPrivateChatProducer.java
@@ -97,7 +97,7 @@ public class XmppPrivateChatProducer extends DefaultProducer {     private Chat getOrCreateChat(ChatManager chatManager, final String participant, String thread) throws XmppStringprepException {
         // this starts a new chat or retrieves the pre-existing one in a threadsafe manner
-        return chatManager.chatWith(JidCreate.entityBareFrom(participant + "@" + thread));
+        return chatManager.chatWith(JidCreate.entityBareFrom(participant));
     }     private synchronized void reconnect() throws InterruptedException, IOException, SmackException, XMPPException {
{code}

  was:
An invalid JID, containing non-LDH characters, is created for the receiver (participant) when a private chat is started. As a result it is not possible to send chat messages directly to an user.

Group chats are not affected by the issue.

See: https://stackoverflow.com/questions/58168566/problem-sending-messages-from-camel-xmpp-jid-malformed

 

Exception seen in Openfire (4.4.3):

 
{code:java}
java.lang.IllegalArgumentException: The input 'xxxx.xxx.xx@chat:xxxxx@xxxx.xxx.xx:camel' is not a valid JID domain part: Contains non-LDH characters.
{code}
 

The issue can be fixed by removing the thread name when the JID is created:

 
{code:java}
diff --git a/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppPrivateChatProducer.java b/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppPrivateChatProducer.java
index b1b30a117ed..6eb1b9cb59c 100644
--- a/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppPrivateChatProducer.java
+++ b/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppPrivateChatProducer.java
@@ -97,7 +97,7 @@ public class XmppPrivateChatProducer extends DefaultProducer {     private Chat getOrCreateChat(ChatManager chatManager, final String participant, String thread) throws XmppStringprepException {
         // this starts a new chat or retrieves the pre-existing one in a threadsafe manner
-        return chatManager.chatWith(JidCreate.entityBareFrom(participant + "@" + thread));
+        return chatManager.chatWith(JidCreate.entityBareFrom(participant));
     }     private synchronized void reconnect() throws InterruptedException, IOException, SmackException, XMPPException {
{code}


> Invalid JID is generated for private chat in XMPP component
> -----------------------------------------------------------
>
>                 Key: CAMEL-14194
>                 URL: https://issues.apache.org/jira/browse/CAMEL-14194
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-xmpp
>    Affects Versions: 2.24.2, 3.0.0.RC3
>            Reporter: Johan Pramming
>            Priority: Major
>
> An invalid JID, containing non-LDH characters, is created for the receiver (participant) when a private chat is started. As a result it is not possible to send chat messages directly to an user.
> Group chats are not affected by the issue.
> See: [https://stackoverflow.com/questions/58168566/problem-sending-messages-from-camel-xmpp-jid-malformed]
>  
> Exception seen in Openfire (4.4.3): 
> {code:java}
> java.lang.IllegalArgumentException: The input 'xxxx.xxx.xx@chat:xxxxx@xxxx.xxx.xx:camel' is not a valid JID domain part: Contains non-LDH characters.
> {code}
>  
> The issue can be fixed by removing the thread name when the JID is created: 
> {code:java}
> diff --git a/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppPrivateChatProducer.java b/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppPrivateChatProducer.java
> index b1b30a117ed..6eb1b9cb59c 100644
> --- a/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppPrivateChatProducer.java
> +++ b/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppPrivateChatProducer.java
> @@ -97,7 +97,7 @@ public class XmppPrivateChatProducer extends DefaultProducer {     private Chat getOrCreateChat(ChatManager chatManager, final String participant, String thread) throws XmppStringprepException {
>          // this starts a new chat or retrieves the pre-existing one in a threadsafe manner
> -        return chatManager.chatWith(JidCreate.entityBareFrom(participant + "@" + thread));
> +        return chatManager.chatWith(JidCreate.entityBareFrom(participant));
>      }     private synchronized void reconnect() throws InterruptedException, IOException, SmackException, XMPPException {
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)