powered by Jive Software

RoomInfo null pointer exceptions

I get null pointer exceptions in the RoomInfo constructor, latest trunk tip rev 9847.

My client is connecting anonymously to a server that is only used for MUC. Not sure if

that has any bearings on the issue. Server is ejabberd 2.0.0.

This is the local patch I use to get around it… Any one knows more what can be the

problem? I can post more info if needed.

$ svn diff
Index: source/org/jivesoftware/smackx/muc/RoomInfo.java
===================================================================
--- source/org/jivesoftware/smackx/muc/RoomInfo.java    (revision 9847)
+++ source/org/jivesoftware/smackx/muc/RoomInfo.java    (working copy)
@@ -88,8 +88,13 @@
         // Get the information based on the discovered extended information
         Form form = Form.getFormFrom(info);
         if (form != null) {
+           try {
             this.description =
                     form.getField("muc#roominfo_description").getValues().next();
+           } catch (NullPointerException e){
+               this.description = e.toString();
+           }
+           try {
             Iterator<String> values = form.getField("muc#roominfo_subject").getValues();
             if (values.hasNext()) {
                 this.subject = values.next();
@@ -97,6 +102,9 @@
             else {
                 this.subject = "";
             }
+           } catch (NullPointerException e){
+               this.subject = e.toString();
+           }
             this.occupantsCount =
                     Integer.parseInt(form.getField("muc#roominfo_occupants").getValues()
                     .next());