Enforce valid range for priority.

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2412 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Matt Tucker 2004-11-05 17:44:05 +00:00 committed by matt
parent a951bf8ba9
commit d800f901a9
1 changed files with 6 additions and 1 deletions

View File

@ -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;
}