1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/*
 * %W% %E%
 * 
 * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
 * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */
package com.sun.javaws.exceptions;
import com.sun.javaws.jnl.LaunchDesc;

/** Root exception for all exceptions thrown by
 *  this JNLP Client
 */
abstract public class JNLPException extends Exception {
    
    // Static reference to the default LaunchDescriptor. This is
    // used in the Error Message if the particular exception does
    // not overwrite it
    static private LaunchDesc _defaultLaunchDesc = null;
    
    // Reference to a exception specific LaunchDesc
    private LaunchDesc _exceptionLaunchDesc = null;
    
    // Specifies what kind of exception it is
    private String _categoryMsg = null;
    
    // Specifies the underlying exception that caused this condition, if any
    private Throwable _wrappedException = null;
    
    /** Construct a JNLP exception */
    public JNLPException(String category) {
        this(category, null, null);
    }
    
    /** Construct a JNLP exception */
    public JNLPException(String category, LaunchDesc ld) {
        this(category, ld, null);
    }
    
    /** Construct a JNLP exception */
    public JNLPException(String category, Throwable exception) {
        this(category, null, exception);
    }
    
    /** Construct a JNLP exception */
    public JNLPException(String category, LaunchDesc ld, Throwable wrappedException) {
        super();
        _categoryMsg = category;
        _exceptionLaunchDesc = ld;
        _wrappedException = wrappedException;
    }
    
    /** Sets the default exception */
    static public void setDefaultLaunchDesc(LaunchDesc ld) { _defaultLaunchDesc = ld; }
    
    /** Get the default LaunchDesc */
    static public LaunchDesc getDefaultLaunchDesc() {
        return _defaultLaunchDesc;
    }
    
    /** Returns the localized error message for the exception. This is overwritten
     *  to call get getRealMessage to force compile time errors if the subclass does
     *  not implemet it
     */
    public String getMessage() { return getRealMessage(); }
    
    public String getBriefMessage() { return null; }

    /** Must be specified by subclass */
    protected abstract String getRealMessage();
    
    /** Get LaunchDesc that was processed when this exception happened. This
     *  method defaults to the default if the exception does not write its own
     */
    public LaunchDesc getLaunchDesc() {
        return (_exceptionLaunchDesc != null) ? _exceptionLaunchDesc : _defaultLaunchDesc;
    }
    
    /** Returns the source of the LaunchDesc. This might be overwritten in subclasses */
    public String getLaunchDescSource() {
        LaunchDesc ld = getLaunchDesc();
        if (ld == null) return null;
        return ld.getSource();
    }
    
    /** Get category for exception */
    public String getCategory() { return _categoryMsg; }
    
    /** Get the expeception that caused this exception to be thrown */
    public Throwable getWrappedException() { return _wrappedException ; }
    
    /** Output */
    public String toString() {
        return "JNLPException[category: " + _categoryMsg +
            " : Exception: " + _wrappedException +
            " : LaunchDesc: " + _exceptionLaunchDesc + " ]"; };
}


			
			

Browsed Source: [clear]