powered by Jive Software

Smack 4.4.0 - registration with CAPTCHA (BoBDataExtension)

Smack 4.4.0

Before I used following to get CAPTCHA bob base 64 string:

Registration registration = ....
StandardExtensionElement extensionElement = (StandardExtensionElement) registration.getExtension(BoBManager.NAMESPACE);
String bobValue = extensionElement.getText();

Now registration.getExtension(BoBManager.NAMESPACE) returns BoBDataExtension so naturally the code above throws

java.lang.ClassCastException: org.jivesoftware.smackx.bob.element.BoBDataExtension cannot be cast to org.jivesoftware.smack.packet.StandardExtensionElement

But if I use BoBDataExtension I cannot access bobData because it is private and there is no getter:


private final BoBData bobData;

Can you please add getter or advise how to do it otherwise?

Thank you

Thanks for reporting this. I have created Smack-896.

I suggest one more change - make BoBDataExtension.from() method to accept Stanza. Because Registration is IQ (Stansa):

    public static BoBDataExtension from(Stanza stanza) {
        return stanza.getExtension(BoBDataExtension.class);
    }

Good point, created SMACK-901

This topic was automatically closed 62 days after the last reply. New replies are no longer allowed.