diff --git a/smack-core/src/main/java/org/jivesoftware/smack/filter/FlexiblePacketTypeFilter.java b/smack-core/src/main/java/org/jivesoftware/smack/filter/FlexiblePacketTypeFilter.java index 80d764a12..5ad7d2409 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/filter/FlexiblePacketTypeFilter.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/filter/FlexiblePacketTypeFilter.java @@ -28,7 +28,7 @@ import org.jivesoftware.smack.packet.Packet; */ public abstract class FlexiblePacketTypeFilter
implements PacketFilter { - final Class
packetType; + protected final Class
packetType; public FlexiblePacketTypeFilter(Class
packetType) { this.packetType = packetType; diff --git a/smack-core/src/main/java/org/jivesoftware/smack/filter/FromMatchesFilter.java b/smack-core/src/main/java/org/jivesoftware/smack/filter/FromMatchesFilter.java index 83eb2648c..f793c032f 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/filter/FromMatchesFilter.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/filter/FromMatchesFilter.java @@ -32,11 +32,12 @@ import org.jxmpp.util.XmppStringUtils; */ public class FromMatchesFilter implements PacketFilter { - private String address; + private final String address; + /** * Flag that indicates if the checking will be done against bare JID addresses or full JIDs. */ - private boolean matchBareJID = false; + private final boolean matchBareJID; /** * Creates a filter matching on the "from" field. The from address must be the same as the diff --git a/smack-core/src/main/java/org/jivesoftware/smack/filter/NotFilter.java b/smack-core/src/main/java/org/jivesoftware/smack/filter/NotFilter.java index 42f252e69..5ab86104c 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/filter/NotFilter.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/filter/NotFilter.java @@ -27,7 +27,7 @@ import org.jivesoftware.smack.packet.Packet; */ public class NotFilter implements PacketFilter { - private PacketFilter filter; + private final PacketFilter filter; /** * Creates a NOT filter using the specified filter. diff --git a/smack-core/src/main/java/org/jivesoftware/smack/filter/PacketIDFilter.java b/smack-core/src/main/java/org/jivesoftware/smack/filter/PacketIDFilter.java index 56498373a..4c31bcdfe 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/filter/PacketIDFilter.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/filter/PacketIDFilter.java @@ -18,6 +18,7 @@ package org.jivesoftware.smack.filter; import org.jivesoftware.smack.packet.Packet; +import org.jivesoftware.smack.util.StringUtils; /** * Filters for packets with a particular packet ID. @@ -26,7 +27,7 @@ import org.jivesoftware.smack.packet.Packet; */ public class PacketIDFilter implements PacketFilter { - private String packetID; + private final String packetID; /** * Creates a new packet ID filter using the specified packet's ID. @@ -43,8 +44,8 @@ public class PacketIDFilter implements PacketFilter { * @param packetID the packet ID to filter for. */ public PacketIDFilter(String packetID) { - if (packetID == null) { - throw new IllegalArgumentException("Packet ID must not be null."); + if (StringUtils.isNullOrEmpty(packetID)) { + throw new IllegalArgumentException("Packet ID must not be null or empty."); } this.packetID = packetID; } diff --git a/smack-core/src/main/java/org/jivesoftware/smack/filter/PacketTypeFilter.java b/smack-core/src/main/java/org/jivesoftware/smack/filter/PacketTypeFilter.java index 8742ff0ef..acd6b3fd7 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/filter/PacketTypeFilter.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/filter/PacketTypeFilter.java @@ -37,7 +37,7 @@ public class PacketTypeFilter implements PacketFilter { public static final PacketTypeFilter PRESENCE = new PacketTypeFilter(Presence.class); public static final PacketTypeFilter MESSAGE = new PacketTypeFilter(Message.class); - Class extends Packet> packetType; + private final Class extends Packet> packetType; /** * Creates a new packet type filter that will filter for packets that are the diff --git a/smack-core/src/main/java/org/jivesoftware/smack/filter/ThreadFilter.java b/smack-core/src/main/java/org/jivesoftware/smack/filter/ThreadFilter.java index aa77ee7c0..ca45733ea 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/filter/ThreadFilter.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/filter/ThreadFilter.java @@ -19,6 +19,7 @@ package org.jivesoftware.smack.filter; import org.jivesoftware.smack.packet.Packet; import org.jivesoftware.smack.packet.Message; +import org.jivesoftware.smack.util.StringUtils; /** * Filters for message packets with a particular thread value. @@ -27,7 +28,7 @@ import org.jivesoftware.smack.packet.Message; */ public class ThreadFilter implements PacketFilter { - private String thread; + private final String thread; /** * Creates a new thread filter using the specified thread value. @@ -35,8 +36,8 @@ public class ThreadFilter implements PacketFilter { * @param thread the thread value to filter for. */ public ThreadFilter(String thread) { - if (thread == null) { - throw new IllegalArgumentException("Thread must not be null."); + if (StringUtils.isNullOrEmpty(thread)) { + throw new IllegalArgumentException("Thread must not be null or empty."); } this.thread = thread; }