Attempting to use ad-hoc commands. SessionID is null error. Is never set

Hi,

I’m attempting to use the ad-hoc command manager, but unless I am using it wrong (there is no documentation), the RemoteCommand class seems to use a sessionID variable before it is set.

I’m trying to recreate example 8 in the XEP-0050 spec, XEP-0050: Ad-Hoc Commands

AdHocCommandManager manager = AdHocCommandManager.getAddHocCommandsManager(connectionA);
        RemoteCommand command = manager.getRemoteCommand(connectionA.getServiceName(), "list");
        command.execute();

The execute method throws the exception: java.lang.IllegalArgumentException: session id must not be null or empty

Looking at the RemoteCommand class, the variable sessionID is never set. The class is never extended and there is no setter. So I can’t see how it would ever be set.

Any ideas?

Thanks,

Phil

Please always post the full stacktrace when reporting exceptions and the used Smack version.

Fixed with Remove nullOrEmpty check for setSessionID() · 888de7e · Flowdalic/Smack · GitHub

Fix is included in the latest 4.1-alpha4 snapshots. Please try and report back if it resolves the issue for you.

This fixes the issue. Tested with 4.1alpha4.

Thanks,

Phil

It’s not fixed. I have smack version 4.1.3 and still receive the same exception.

Please follow the instructions found at https://github.com/igniterealtime/Smack/wiki/How-to-ask-for-help,-report-an-issu e-and-possible-solve-the-problem-yourself when asking for help. Thank you.