powered by Jive Software

Fix for PacketParserUtils not handling byte and short types

I had use of these types, and found that PacketParserUtils did not handle them along with the other primitive data types.

This fix applies to org.jivesoftware.smack.util.PacketParserUtils.

It’s a simple addition to the decode function:

@@ -896,6 +896,12 @@

if (type.getName().equals(“double”)) {

return Double.valueOf(value);

}

  •    if (type.getName().equals("short")) {
    
  •        return Short.valueOf(value);
    
  •    }
    
  •    if (type.getName().equals("byte")) {
    
  •        return Byte.valueOf(value);
    
  •    }
    

if (type.getName().equals(“java.lang.Class”)) {

return Class.forName(value);

}
PacketParserUtils.diff.zip (654 Bytes)

Thanks, logged as SMACK-453

One note:

The patch adds support for short and byte. However, Java supports two more primitive types, boolean and char.