001/**
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *     http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018package org.apache.hadoop.security.authorize;
019
020import java.io.PrintStream;
021import java.io.PrintWriter;
022
023import org.apache.hadoop.classification.InterfaceAudience;
024import org.apache.hadoop.classification.InterfaceStability;
025import org.apache.hadoop.security.AccessControlException;
026
027/**
028 * An exception class for authorization-related issues.
029 * 
030 * This class <em>does not</em> provide the stack trace for security purposes.
031 */
032@InterfaceAudience.Public
033@InterfaceStability.Evolving
034public class AuthorizationException extends AccessControlException {
035  private static final long serialVersionUID = 1L;
036
037  public AuthorizationException() {
038    super();
039  }
040
041  public AuthorizationException(String message) {
042    super(message);
043  }
044  
045  /**
046   * Constructs a new exception with the specified cause and a detail
047   * message of <tt>(cause==null ? null : cause.toString())</tt> (which
048   * typically contains the class and detail message of <tt>cause</tt>).
049   * @param  cause the cause (which is saved for later retrieval by the
050   *         {@link #getCause()} method).  (A <tt>null</tt> value is
051   *         permitted, and indicates that the cause is nonexistent or
052   *         unknown.)
053   */
054  public AuthorizationException(Throwable cause) {
055    super(cause);
056  }
057  
058  private static StackTraceElement[] stackTrace = new StackTraceElement[0];
059  @Override
060  public StackTraceElement[] getStackTrace() {
061    // Do not provide the stack-trace
062    return stackTrace;
063  }
064
065  @Override
066  public void printStackTrace() {
067    // Do not provide the stack-trace
068  }
069
070  @Override
071  public void printStackTrace(PrintStream s) {
072    // Do not provide the stack-trace
073  }
074
075  @Override
076  public void printStackTrace(PrintWriter s) {
077    // Do not provide the stack-trace
078  }
079  
080}