Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/java.security.jgss/share/classes/sun/security/jgss/GSSExceptionImpl.java
41159 views
1
/*
2
* Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation. Oracle designates this
8
* particular file as subject to the "Classpath" exception as provided
9
* by Oracle in the LICENSE file that accompanied this code.
10
*
11
* This code is distributed in the hope that it will be useful, but WITHOUT
12
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
* version 2 for more details (a copy is included in the LICENSE file that
15
* accompanied this code).
16
*
17
* You should have received a copy of the GNU General Public License version
18
* 2 along with this work; if not, write to the Free Software Foundation,
19
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20
*
21
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
* or visit www.oracle.com if you need additional information or have any
23
* questions.
24
*/
25
26
package sun.security.jgss;
27
28
import org.ietf.jgss.*;
29
30
/**
31
* This class helps overcome a limitation of the org.ietf.jgss.GSSException
32
* class that does not allow the thrower to set a string corresponding to
33
* the major code.
34
*/
35
public class GSSExceptionImpl extends GSSException {
36
37
private static final long serialVersionUID = 4251197939069005575L;
38
39
private String majorMessage;
40
41
/**
42
* A constructor that takes the majorCode as well as the mech oid that
43
* will be appended to the standard message defined in its super class.
44
*/
45
GSSExceptionImpl(int majorCode, Oid mech) {
46
super(majorCode);
47
this.majorMessage = super.getMajorString() + ": " + mech;
48
}
49
50
/**
51
* A constructor that takes the majorCode as well as the message that
52
* corresponds to it.
53
*/
54
public GSSExceptionImpl(int majorCode, String majorMessage) {
55
super(majorCode);
56
this.majorMessage = majorMessage;
57
}
58
59
/**
60
* A constructor that takes the majorCode and the exception cause.
61
*/
62
public GSSExceptionImpl(int majorCode, Exception cause) {
63
super(majorCode);
64
initCause(cause);
65
}
66
67
/**
68
* A constructor that takes the majorCode, the message that
69
* corresponds to it, and the exception cause.
70
*/
71
public GSSExceptionImpl(int majorCode, String majorMessage,
72
Exception cause) {
73
this(majorCode, majorMessage);
74
initCause(cause);
75
}
76
77
/**
78
* Returns the message that was embedded in this object, otherwise it
79
* returns the default message that an org.ietf.jgss.GSSException
80
* generates.
81
*/
82
public String getMessage() {
83
if (majorMessage != null)
84
return majorMessage;
85
else
86
return super.getMessage();
87
}
88
89
}
90
91