1 /**
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements.  See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership.  The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License.  You may obtain a copy of the License at
9  *
10  *     http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 package org.apache.hadoop.security.authorize;
19 
20 import java.io.PrintStream;
21 import java.io.PrintWriter;
22 
23 import org.apache.hadoop.classification.InterfaceAudience;
24 import org.apache.hadoop.classification.InterfaceStability;
25 import org.apache.hadoop.security.AccessControlException;
26 
27 /**
28  * An exception class for authorization-related issues.
29  *
30  * This class <em>does not</em> provide the stack trace for security purposes.
31  */
32 @InterfaceAudience.LimitedPrivate({"HDFS", "MapReduce", "YARN"})
33 @InterfaceStability.Evolving
34 public class AuthorizationException extends AccessControlException {
35   private static final long serialVersionUID = 1L;
36 
AuthorizationException()37   public AuthorizationException() {
38     super();
39   }
40 
AuthorizationException(String message)41   public AuthorizationException(String message) {
42     super(message);
43   }
44 
45   /**
46    * Constructs a new exception with the specified cause and a detail
47    * message of <tt>(cause==null ? null : cause.toString())</tt> (which
48    * typically contains the class and detail message of <tt>cause</tt>).
49    * @param  cause the cause (which is saved for later retrieval by the
50    *         {@link #getCause()} method).  (A <tt>null</tt> value is
51    *         permitted, and indicates that the cause is nonexistent or
52    *         unknown.)
53    */
AuthorizationException(Throwable cause)54   public AuthorizationException(Throwable cause) {
55     super(cause);
56   }
57 
58   private static StackTraceElement[] stackTrace = new StackTraceElement[0];
59   @Override
getStackTrace()60   public StackTraceElement[] getStackTrace() {
61     // Do not provide the stack-trace
62     return stackTrace;
63   }
64 
65   @Override
printStackTrace()66   public void printStackTrace() {
67     // Do not provide the stack-trace
68   }
69 
70   @Override
printStackTrace(PrintStream s)71   public void printStackTrace(PrintStream s) {
72     // Do not provide the stack-trace
73   }
74 
75   @Override
printStackTrace(PrintWriter s)76   public void printStackTrace(PrintWriter s) {
77     // Do not provide the stack-trace
78   }
79 
80 }
81