package com.sun.javaws.exceptions;
import com.sun.javaws.jnl.LaunchDesc;
abstract public class JNLPException extends Exception {
static private LaunchDesc _defaultLaunchDesc = null;
private LaunchDesc _exceptionLaunchDesc = null;
private String _categoryMsg = null;
private Throwable _wrappedException = null;
public JNLPException(String category) {
this(category, null, null);
}
public JNLPException(String category, LaunchDesc ld) {
this(category, ld, null);
}
public JNLPException(String category, Throwable exception) {
this(category, null, exception);
}
public JNLPException(String category, LaunchDesc ld, Throwable wrappedException) {
super();
_categoryMsg = category;
_exceptionLaunchDesc = ld;
_wrappedException = wrappedException;
}
static public void setDefaultLaunchDesc(LaunchDesc ld) { _defaultLaunchDesc = ld; }
static public LaunchDesc getDefaultLaunchDesc() {
return _defaultLaunchDesc;
}
public String getMessage() { return getRealMessage(); }
public String getBriefMessage() { return null; }
protected abstract String getRealMessage();
public LaunchDesc getLaunchDesc() {
return (_exceptionLaunchDesc != null) ? _exceptionLaunchDesc : _defaultLaunchDesc;
}
public String getLaunchDescSource() {
LaunchDesc ld = getLaunchDesc();
if (ld == null) return null;
return ld.getSource();
}
public String getCategory() { return _categoryMsg; }
public Throwable getWrappedException() { return _wrappedException ; }
public String toString() {
return "JNLPException[category: " + _categoryMsg +
" : Exception: " + _wrappedException +
" : LaunchDesc: " + _exceptionLaunchDesc + " ]"; };
}