Exception on xep-0050 <note> element

Hi,

I’m using Smack 4.0.5 in a java stand alone client for calling a remote xmpp server.

It seems that Smack doesn’t like an empty element sent by the server. Please check the following server message and the consequent Smack Exception:

   <command xmlns="[http://jabber.org/protocol/commands](http://jabber.org/protocol/commands)" sessionid="2ykD1043j47e7H1" node="[http://bossmedia.com/protocol/bingo-admin#create-muc-room](http://bossmedia.com/protocol/bingo-admin#create-muc-room)" status="completed">

         <note/>

         <x xmlns="jabber:x:data" type="result">

                <reported>

                       <field var="room_jid" type="text-single" label="Room JID"/>

                </reported>

                <item>

                       <field var="room_jid">

                              <value>testgioid@msg01.lxrt2-newbingo-as01.lottomatica.net</value>

                       </field>

                </item>

         </x>

   </command>

java.lang.NullPointerException: Name is null

at java.lang.Enum.valueOf(Enum.java:235)

at org.jivesoftware.smackx.commands.AdHocCommandNote$Type.valueOf(AdHocCommandNote .java:62)

at org.jivesoftware.smackx.commands.provider.AdHocCommandDataProvider.parseIQ(AdHo cCommandDataProvider.java:99)

at org.jivesoftware.smack.util.PacketParserUtils.parseIQ(PacketParserUtils.java:46 3)

at org.jivesoftware.smack.tcp.PacketReader.parsePackets(PacketReader.java:174)

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

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

If I force the server to send something inside the element, everything works well. E.g.:

   <command xmlns="[http://jabber.org/protocol/commands](http://jabber.org/protocol/commands)" sessionid="2ykD1043j47e7H1" node="[http://bossmedia.com/protocol/bingo-admin#create-muc-room](http://bossmedia.com/protocol/bingo-admin#create-muc-room)" status="completed">

         <note type="info">Don't look at me</note>

         <x xmlns="jabber:x:data" type="result">

                <reported>

                       <field var="room_jid" type="text-single" label="Room JID"/>

                </reported>

                <item>

                       <field var="room_jid">

                              <value>testgioid@msg01.lxrt2-newbingo-as01.lottomatica.net</value>

                       </field>

                </item>

         </x>

   </command>

I’ve searched the documentation for this element and I’ve found this: XEP-0050: Ad-Hoc Commands

It seems that an empty should be allowed.

Could it be a Smack bug?

Thanks

John

The schema provided by XEP-50 reads

<xs:element name=‘note’>
xs:complexType
xs:simpleContent
<xs:extension base=‘xs:string’>
<xs:attribute name=‘type’ use=‘required’>

while section 4.3 states

The “type” attribute specifies the severity of the note. This attribute is OPTIONAL, and implies “info” if not present. The value of this attribute MUST be one of the following:

I consider the schema to be more authoritative. It’s also what’s easier to implement. But will ask on the XMPP standards list for clarification.

Thanks for pointing this out.

Hi Flow,

thank you for the response. Do you have any idea on when the fix will be done in case?

John

See [Standards] XEP-50: Schema and text contradiction regarding ‘note’ element

I did not get an answer and I consider the schema to be more authoritative, which means Smack is correct and it’s the creator of the stanza who should get fixed.

Clear, thanks again.

I’ve created [SMACK-741] Ad-hoc command ‘note’ element ‘type’ attribute should be treated as optional - IgniteRealtime JIRA