package com.jivesoftware.forum; import java.io.PrintStream; 
import java.io.PrintWriter; /** 
* Thrown if a User does not have permission to access a particular method. 

* @author yangyong 

*/ 
public class UnauthorizedException extends Exception { private Throwable nestedThrowable = null; public UnauthorizedException() { 
super(); 
// TODO Auto-generated constructor stub 
} public UnauthorizedException(String message) { 
super(message); 
// TODO Auto-generated constructor stub 
} public UnauthorizedException(Throwable nestedThrowable) { 
this.nestedThrowable=nestedThrowable; 
} public UnauthorizedException(String msg, Throwable nestedThrowable) { 
super(msg); 
this.nestedThrowable=nestedThrowable; 
} public void printStackTrace(){ 
super.printStackTrace(); 
if(nestedThrowable!=null){ 
nestedThrowable.printStackTrace(); 

} public void printStackTrace(PrintStream ps){ 
super.printStackTrace(ps); 
if(nestedThrowable!=null){ 
nestedThrowable.printStackTrace(ps); 

} public void printStackTrace(PrintWriter pw){ 
super.printStackTrace(pw); 
if(nestedThrowable!=null){ 
nestedThrowable.printStackTrace(pw); 



今天看了一下这个自定义的类,为什么要先用super.printStackTrace(pw);后用 
if(nestedThrowable!=null){ 
nestedThrowable.printStackTrace(pw); 
}? 不是只用一条nestedThrowable.printStackTrace(pw);不就行了吗, 这是为什么呢