From 226614e200168cb3de36202a78acd032677f7f4d Mon Sep 17 00:00:00 2001 From: Nick Hudson Date: Fri, 27 Jun 2014 11:44:37 +0100 Subject: Fix incorrect initialisation of jid_ field inside IQRouter The class IQRouter has a private "jid_" field that was not being initialised to contain an invalid JID, which meant that there was a risk of NullPointerException if anyone called the "getJID()" method and tried to use the returned JID. This showed up because one of the unit tests was getting a NullPointerException, which caused the failure: [junit] Test com.isode.stroke.queries.requests.GetPrivateStorageRequestTest FAILED The failure was shown to have been introduced by the change "Check sender on incoming IQ responses" (535e1a979a164f807aa64bf2df2bb36e7015ff17) This change fixes the initialisation. The other fields in this class are always initialised so can never be null. Test-information: After this patch, unit tests no longer show the failure. Change-Id: Idfcabf5393c8353194dddc414d58c37301487908 diff --git a/src/com/isode/stroke/queries/IQRouter.java b/src/com/isode/stroke/queries/IQRouter.java index f35cab4..409d02b 100644 --- a/src/com/isode/stroke/queries/IQRouter.java +++ b/src/com/isode/stroke/queries/IQRouter.java @@ -27,7 +27,7 @@ public class IQRouter { private final Vector handlers_ = new Vector(); private final IQChannel channel_; - private JID jid_; + private JID jid_ = new JID(); public IQRouter(IQChannel channel) { channel_ = channel; -- cgit v0.10.2-6-g49f6