diff options
author | Nick Hudson <nick.hudson@isode.com> | 2014-06-27 10:44:37 (GMT) |
---|---|---|
committer | Nick Hudson <nick.hudson@isode.com> | 2014-06-27 10:54:36 (GMT) |
commit | 226614e200168cb3de36202a78acd032677f7f4d (patch) | |
tree | 7ad73a902aa9c9bb866c0bcafce528c9ec691f92 /src/com/isode | |
parent | f17907c88ed455f3e4bacaa737ef0406a82ef64c (diff) | |
download | stroke-226614e200168cb3de36202a78acd032677f7f4d.zip stroke-226614e200168cb3de36202a78acd032677f7f4d.tar.bz2 |
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
Diffstat (limited to 'src/com/isode')
-rw-r--r-- | src/com/isode/stroke/queries/IQRouter.java | 2 |
1 files changed, 1 insertions, 1 deletions
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<IQHandler> handlers_ = new Vector<IQHandler>(); private final IQChannel channel_; - private JID jid_; + private JID jid_ = new JID(); public IQRouter(IQChannel channel) { channel_ = channel; |