1 /*
2  * Copyright (C) 2004-2008 Jive Software. All rights reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package org.jivesoftware.openfire.muc;
18 
19 import java.io.PrintStream;
20 import java.io.PrintWriter;
21 
22 /**
23  * Exception used for representing that the user is not allowed to perform the requested operation
24  * in the MUCRoom. There are many reasons why a not-allowed error could occur such as: a user tries
25  * to join a room that has reached its limit of max number of occupants. A 405 error code is
26  * returned to the user that requested the invalid operation.
27  *
28  * @author Gaston Dombiak
29  */
30 public class NotAllowedException extends Exception {
31 
32     private static final long serialVersionUID = 1L;
33 
34     private Throwable nestedThrowable = null;
35 
NotAllowedException()36     public NotAllowedException() {
37         super();
38     }
39 
NotAllowedException(String msg)40     public NotAllowedException(String msg) {
41         super(msg);
42     }
43 
NotAllowedException(Throwable nestedThrowable)44     public NotAllowedException(Throwable nestedThrowable) {
45         this.nestedThrowable = nestedThrowable;
46     }
47 
NotAllowedException(String msg, Throwable nestedThrowable)48     public NotAllowedException(String msg, Throwable nestedThrowable) {
49         super(msg);
50         this.nestedThrowable = nestedThrowable;
51     }
52 
53     @Override
printStackTrace()54     public void printStackTrace() {
55         super.printStackTrace();
56         if (nestedThrowable != null) {
57             nestedThrowable.printStackTrace();
58         }
59     }
60 
61     @Override
printStackTrace(PrintStream ps)62     public void printStackTrace(PrintStream ps) {
63         super.printStackTrace(ps);
64         if (nestedThrowable != null) {
65             nestedThrowable.printStackTrace(ps);
66         }
67     }
68 
69     @Override
printStackTrace(PrintWriter pw)70     public void printStackTrace(PrintWriter pw) {
71         super.printStackTrace(pw);
72         if (nestedThrowable != null) {
73             nestedThrowable.printStackTrace(pw);
74         }
75     }
76 }
77