powered by Jive Software

4.1 aplha 4 XMPPErrorException is null

I am not using create account but creating account using my custom method as i need to pass more attributes than just username and password.

it was working all good until 4.0.5 however in 4.1 alpha 4 when i am using

result=createPacketCollectorAndSend(reg).nextResultOrThrow(SmackConfiguration.ge tDefaultPacketReplyTimeout());

on any error like conflict or flooding / resource-constraint error it goes in catch which is exptected as its nextResultOrThrow but in catch the exception is always null instead of the error.

when i use nextResult i can use if else to get the error response using IQ.type.error.

Registration reg = new Registration(accountattribs);
                    reg.setType(IQ.Type.set);
                    reg.setTo(ConnectionsManager.getInstance().getConnection().getServiceName());
                    result=createPacketCollectorAndSend(reg).nextResultOrThrow(SmackConfiguration.getDefaultPacketReplyTimeout());
                    if (result == null) {
                        FileLog.d(log_tag, "No response from server.");
                        response = "No response from server";
                    } else if (result.getType() == IQ.Type.error) {
                        FileLog.d(log_tag, result.getError().toString());
                        response = result.getError().toString();
                    } else if (result.getType() == IQ.Type.result) {
                        response = "Successful";
                    }
                } else {
                    FileLog.d(log_tag, "Account creation not supported");
                    response = "Could not reach datacenter";
                }
            } catch (SmackException.NotConnectedException nE ) {
                FileLog.e(log_tag, nE);
                           } catch (XMPPException.XMPPErrorException xe){
                FileLog.e(log_tag, xe);                                     // XE is ALWAYS NULL on error
                           }catch (SmackException.NoResponseException nR){
                FileLog.e(log_tag, nR);
                           }
        }

What you describe is not possible, i.e. xe in line 22 can not be null as it’s an exception that was catched.

BTW there is AccountManager.createAccount(String, String, Map<String, String>) just for your use case: To add extra attributes to the registration.

I know its not possible somehow it is coming as null …

I can send you the stack trace and screen shot from the debugger if you want.