Bug in Smack 3.1 library (data forms: XEP-0004)

I noticed the following behavior in Smack using data forms (XEP-0004).

When smack inserts text in a message packet body, it escapes invalid XML character properly.

For instance,

&

is converted to

&

as expected

However when inserting the same data in forms, this escaping is not done. I am including the Scala code that generates the error along with a screenshot that shows the error

The Scala code creates a message packet and inserts a user-specified string in the body. It also adds a dataform to the packet and inserts the same string as the value of a form field.

From the screenshot, we can see that the message body contents are properly escaped while the form field contents are not.

Note: I have not given the code for Util.readUserInput() and conn(). However the two functions return as follows:

readUserInput reads user’s input from standard input after giving a prompt and returns that input; conn() returns a Connection object.

I think this is a bug in the Smack library itself. (Smack version: smack_3_1_0).
smackBug.scala.zip (790 Bytes)