From d800f901a96566d4ca5ab237e7520332f9d21de5 Mon Sep 17 00:00:00 2001 From: Matt Tucker Date: Fri, 5 Nov 2004 17:44:05 +0000 Subject: [PATCH] Enforce valid range for priority. git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2412 b35dd754-fafc-0310-a699-88a17e54d16e --- source/org/jivesoftware/smack/packet/Presence.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source/org/jivesoftware/smack/packet/Presence.java b/source/org/jivesoftware/smack/packet/Presence.java index 30ec27132..9e47cbb75 100644 --- a/source/org/jivesoftware/smack/packet/Presence.java +++ b/source/org/jivesoftware/smack/packet/Presence.java @@ -135,11 +135,16 @@ public class Presence extends Packet { } /** - * Sets the priority of the presence. + * Sets the priority of the presence. The valid range is -128 through 128. * * @param priority the priority of the presence. + * @throws IllegalArgumentException if the priority is outside the valid range. */ public void setPriority(int priority) { + if (priority < -128 || priority > 128) { + throw new IllegalArgumentException("Priority value " + priority + + " is not valid. Valid range is -128 through 128."); + } this.priority = priority; }