This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 176882 - IllegalStateException on Kenai login, if project chat room contains malformed message
Summary: IllegalStateException on Kenai login, if project chat room contains malformed...
Status: STARTED
Alias: None
Product: connecteddeveloper
Classification: Unclassified
Component: Chat (show other bugs)
Version: 6.x
Hardware: PC Mac OS X
: P3 normal (vote)
Assignee: Jan Becicka
URL: http://www.igniterealtime.org/issues/...
Keywords:
: 168234 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-11-16 05:03 UTC by Petr Dvorak
Modified: 2010-06-17 14:33 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
patch for smack (1.33 KB, patch)
2010-01-06 01:27 UTC, Jan Becicka
Details | Diff
stacktrace (782 bytes, text/plain)
2010-04-12 22:09 UTC, Jesse Glick
Details
Patched smack.jar (279.17 KB, application/octet-stream)
2010-04-13 08:43 UTC, Jan Becicka
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Dvorak 2009-11-16 05:03:20 UTC
Product Version: NetBeans IDE Dev (Build 091113-81757c241efd)
Java: 1.5.0_20; Java HotSpot(TM) Client VM 1.5.0_20-141
System: Mac OS X version 10.5.8 running on i386; MacRoman; en_US (nb)

Anytime a login to Kenai, I get this exception (with clean userdir or not):

java.lang.IllegalStateException: Not connected to server.
	at org.jivesoftware.smack.XMPPConnection.addPacketListener(XMPPConnection.java:747)
	at org.jivesoftware.smackx.muc.MultiUserChat.addMessageListener(MultiUserChat.java:1880)
	at org.netbeans.modules.kenai.collab.chat.KenaiConnection.createChat(KenaiConnection.java:150)
	at org.netbeans.modules.kenai.collab.chat.KenaiConnection.initChats(KenaiConnection.java:353)
	at org.netbeans.modules.kenai.collab.chat.KenaiConnection.tryConnect(KenaiConnection.java:207)
	at org.netbeans.modules.kenai.collab.chat.KenaiConnection$1.run(KenaiConnection.java:411)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:602)
[catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:1084)

If I submit the issue using the exceptions reporter, it is marked as duplicate of issue 168234 but the strange thing is that the chat and other Kenai functionality seems to work fine for me (in that issue, the problem was in the chat). It may indicate this symptom (exception) has different cause than the other issue. Also, I didn't do anything with my password recently...
Comment 1 Petr Dvorak 2009-11-16 05:06:20 UTC
Hmm... actually, the chat works strange... I see number of the messages, sometimes even messages for a particular chatroom, but I am not able to send messages... :( Probably some idiotic server issue again...
Comment 2 Jan Becicka 2009-11-16 05:38:52 UTC
Any time login to kenai? It seems to be stopper!
Comment 3 Petr Dvorak 2009-11-16 05:49:23 UTC
It is anytime I login to Kenai using my Sun account. Other logins, for example cdev_unit/****** works fine, no exception is thrown.
Comment 4 Jan Becicka 2009-11-16 06:08:38 UTC
It does not work for me as well. Needs to be properly evaluated.
Comment 5 Jan Becicka 2009-11-16 07:59:17 UTC
 I did some debugging and problem seems to be in invalid message in
chatroom of project "kenai":

--------------
<message xmlns='jabber:client' from='kenai@muc.kenai.com/Frederic Jean'
id='1258145104804+purplef5b633d8' to='jbecicka@kenai.com/NetBeans'
type='groupchat' xml:lang='en'><body>502 - Bad Gateway
A 502 status code indicates that a server, while acting as a proxy,
received a response from a server further upstream that it judged
invalid.</body><body xmlns='http://www.w3.org/1999/xhtml'><span
style='font-weight: bold;'>502 - Bad Gateway</span>A 502 status code
indicates that a server, while acting as a proxy, received a response
from a server further upstream that it judged invalid.</body><delay
xmlns='urn:xmpp:delay' stamp='2009-11-13T20:45:04.804+00:00'/></message>
-----------------

this message cause error in Smack (xmpp library):

-----------------
org.xmlpull.v1.XmlPullParserException: parser must be on START_TAG or
TEXT to read text (position: START_TAG seen
...s=\'http://www.w3.org/1999/xhtml\'><span style=\'font-weight:
bold;\'>... @143:226)
        at org.xmlpull.mxp1.MXParser.nextText(MXParser.java:1071)
        at
org.jivesoftware.smack.util.PacketParserUtils.parseMessage(PacketParserUtils.java:89)
        at
org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:272)
        at
org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:44)
        at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:76)
------------------

The problematic message above has 2 <body> elements, which is against
xmpp spec:
http://www.ietf.org/rfc/rfc3921.txt

---------------------
2.1.2.2.  Body

   The <body/> element contains human-readable XML character data that
   specifies the textual contents of the message; this child element is
   normally included but is OPTIONAL.  The <body/> element MUST NOT
   possess any attributes, with the exception of the 'xml:lang'
   attribute.  Multiple instances of the <body/> element MAY be included
   but only if each instance possesses an 'xml:lang' attribute with a
   distinct language value.  The <body/> element MUST NOT contain mixed
   content (as defined in Section 3.2.2 of [XML]).
---------------------
Comment 6 Jan Becicka 2009-11-18 08:11:01 UTC
Bug reported to smack:
http://www.igniterealtime.org/community/message/198213
Comment 7 Jan Becicka 2009-12-22 05:59:21 UTC
*** Bug 168234 has been marked as a duplicate of this bug. ***
Comment 8 Jesse Glick 2009-12-22 09:01:47 UTC
Happens to me when I am logged in using my @sun.com account. I am a member of several projects.
Comment 9 Jan Becicka 2009-12-22 09:13:14 UTC
Jesse, of course you are member of several projects. But kenai.com project "kenai" contains some invalid xmpp messages in its project chat room, which cause Smack Library serious problems which leads to this bug.
Comment 10 Jesse Glick 2009-12-22 09:16:43 UTC
Ah, I misparsed your question. Yes, I am a member of the 'kenai' project.
Comment 11 Jan Becicka 2010-01-06 01:27:59 UTC
Created attachment 93092 [details]
patch for smack

patch for smack.jar
Comment 12 Jan Becicka 2010-03-25 17:04:40 UTC
better patch available at http://www.igniterealtime.org/community/thread/41420
Comment 13 Jesse Glick 2010-04-12 22:09:22 UTC
Created attachment 97128 [details]
stacktrace

Just logged in to Kenai.
Comment 14 Jan Becicka 2010-04-13 08:40:59 UTC
OK. So what to do with this issue? The bug is in smack library. We have a patch, which was tested by author and me will not be integrated into official smack release in near future, because smack project is not very active.

I'm attaching patched version of smack.jar for testing.

We have 2 options:
1. Close this bug as invalid (the bug is not in netbeans code)
2. Waive the bug for 6.9 and wait, if the new version of smack will include this patch
3. Test the patch and if it is OK, distribute patched smack with NetBeans
Comment 15 Jan Becicka 2010-04-13 08:43:56 UTC
Created attachment 97142 [details]
Patched smack.jar

replacement for ide/modules/ext/smack.jar
Comment 16 Jan Becicka 2010-05-05 14:21:50 UTC
waiver request justification: 

IllegalStateException is thrown, if malformed chat message is sent to team project chat room. The bug is not in NetBeans code, but in smack library, which is out of NetBeans control. Also we have patch for smack.jar, we cannot expect, that the patch will be integrated into smack SVN repository in 69 timeframe. I propose to waive this bug.
Comment 17 Jan Becicka 2010-05-12 14:26:41 UTC
Exception is now only informational.
http://hg.netbeans.org/main-silver?cmd=changeset;node=6e2c3a677744
Comment 18 Quality Engineering 2010-05-13 05:06:22 UTC
Integrated into 'main-golden', will be available in build *201005122200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/
User: 
Log:
Comment 19 Jan Becicka 2010-06-17 14:32:00 UTC
Will be probably fixed in Smack 3.1.1.
http://www.igniterealtime.org/issues/browse/SMACK-307