powered by Jive Software

Using .close() causes exception

Okay, for now I just started using the precompiled smack.jar file to play around with it. First, let me say I really like what I see so far in the JavaDocs. I added a “connection.close()” to your three line example, and got a rather bulky looking exception. Maybe it’‘s trying to close twice and the 2nd fails cause the socket isn’‘t there? Here’'s what I get:

java.net.SocketException: Socket closed

at java.net.SocketInputStream.socketRead0(Native Method)

at java.net.SocketInputStream.read(SocketInputStream.java:116)

at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:404)

at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:442)

at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:179)

at java.io.InputStreamReader.read(InputStreamReader.java:167)

at org.xmlpull.mxp1.MXParser.fillBuf(MXParser.java:2958)

at org.xmlpull.mxp1.MXParser.more(MXParser.java:2975)

at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1188)

at org.xmlpull.mxp1.MXParser.next(MXParser.java:1137)

at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:262)

at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:73)

at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:95)

I’‘m guessing my manual close() is not required at all. The class should prolly check to make sure the connection wasn’'t left in a closed state before closing again on cleanup.




I have a feeling that close is working ok, but its printing out some errors that it shouldn’‘t be. I’'ll try to incorporate a fix for the next beta so that it looks cleaner.

BTW, thanks for your positive comments!



For now, I’‘m just gonna catch that exception and ignore it. I like this api much better than JabberBeans. It’'s very simple and has some neat features. Any eta on the Roster, btw?



Any eta on the Roster, btw?

I was hoping to have beta 2 out tomorrow with roster support, but I don’‘t think that will happen. I’'ll do my best to have it out early next week.

BTW, please let me know if you find any parts of the API confusing or lacking. As Smack is still very young code, we’'re happy to make significant changes based on user feedback.


We can wait for roster, sounds like it’‘s just around the corner! We’'ll be messing with Smack a lot for the next few days, running it thru its paces. Happy with it so far, good work!

FYI, the close() bug is in the issue database as smack-7[/issue]



Can you say when new version of smack will be available?

I’'m very interested in solution of this problem

We’‘ll most likely have another release within the next two days. Unfortunately, we don’'t have a good way to provide anonymous access to cvs at the moment, but perhaps we can get nightly builds setup soon so that people can get quicker access to fixes.