1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-29 23:42:06 +01:00

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

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. * @param priority the priority of the presence.
* @throws IllegalArgumentException if the priority is outside the valid range.
*/ */
public void setPriority(int priority) { 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; this.priority = priority;
} }