jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/SOAPExceptionImpl.java
equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
84 } |
84 } |
85 |
85 |
86 /** |
86 /** |
87 * Constructs a <code>SOAPExceptionImpl</code> object initialized |
87 * Constructs a <code>SOAPExceptionImpl</code> object initialized |
88 * with the given <code>Throwable</code> object. |
88 * with the given <code>Throwable</code> object. |
|
89 * @param cause cause |
89 */ |
90 */ |
90 public SOAPExceptionImpl(Throwable cause) { |
91 public SOAPExceptionImpl(Throwable cause) { |
91 super (cause.toString()); |
92 super (cause.toString()); |
92 initCause(cause); |
93 initCause(cause); |
93 } |
94 } |
104 * @return the error or warning message for this |
105 * @return the error or warning message for this |
105 * <code>SOAPExceptionImpl</code> or, if it has none, the |
106 * <code>SOAPExceptionImpl</code> or, if it has none, the |
106 * message of the embedded <code>Throwable</code> object, |
107 * message of the embedded <code>Throwable</code> object, |
107 * if there is one |
108 * if there is one |
108 */ |
109 */ |
|
110 @Override |
109 public String getMessage() { |
111 public String getMessage() { |
110 String message = super.getMessage (); |
112 String message = super.getMessage (); |
111 if (message == null && cause != null) { |
113 if (message == null && cause != null) { |
112 return cause.getMessage(); |
114 return cause.getMessage(); |
113 } else { |
115 } else { |
122 * |
124 * |
123 * @return the embedded <code>Throwable</code> object or <code>null</code> |
125 * @return the embedded <code>Throwable</code> object or <code>null</code> |
124 * if there is none |
126 * if there is none |
125 */ |
127 */ |
126 |
128 |
|
129 @Override |
127 public Throwable getCause() { |
130 public Throwable getCause() { |
128 return cause; |
131 return cause; |
129 } |
132 } |
130 |
133 |
131 /** |
134 /** |
155 * was created with {@link #SOAPExceptionImpl(Throwable)} or |
158 * was created with {@link #SOAPExceptionImpl(Throwable)} or |
156 * {@link #SOAPExceptionImpl(String,Throwable)}, or this |
159 * {@link #SOAPExceptionImpl(String,Throwable)}, or this |
157 * method has already been called on this <code>SOAPExceptionImpl</code> |
160 * method has already been called on this <code>SOAPExceptionImpl</code> |
158 * object |
161 * object |
159 */ |
162 */ |
|
163 @Override |
160 public synchronized Throwable initCause(Throwable cause) |
164 public synchronized Throwable initCause(Throwable cause) |
161 { |
165 { |
162 if(this.cause != null) { |
166 if(this.cause != null) { |
163 throw new IllegalStateException("Can't override cause"); |
167 throw new IllegalStateException("Can't override cause"); |
164 } |
168 } |
168 this.cause = cause; |
172 this.cause = cause; |
169 |
173 |
170 return this; |
174 return this; |
171 } |
175 } |
172 |
176 |
|
177 @Override |
173 public void printStackTrace() { |
178 public void printStackTrace() { |
174 super.printStackTrace(); |
179 super.printStackTrace(); |
175 if (cause != null) { |
180 if (cause != null) { |
176 System.err.println("\nCAUSE:\n"); |
181 System.err.println("\nCAUSE:\n"); |
177 cause.printStackTrace(); |
182 cause.printStackTrace(); |
178 } |
183 } |
179 } |
184 } |
180 |
185 |
|
186 @Override |
181 public void printStackTrace(PrintStream s) { |
187 public void printStackTrace(PrintStream s) { |
182 super.printStackTrace(s); |
188 super.printStackTrace(s); |
183 if (cause != null) { |
189 if (cause != null) { |
184 s.println("\nCAUSE:\n"); |
190 s.println("\nCAUSE:\n"); |
185 cause.printStackTrace(s); |
191 cause.printStackTrace(s); |
186 } |
192 } |
187 } |
193 } |
188 |
194 |
|
195 @Override |
189 public void printStackTrace(PrintWriter s) { |
196 public void printStackTrace(PrintWriter s) { |
190 super.printStackTrace(s); |
197 super.printStackTrace(s); |
191 if (cause != null) { |
198 if (cause != null) { |
192 s.println("\nCAUSE:\n"); |
199 s.println("\nCAUSE:\n"); |
193 cause.printStackTrace(s); |
200 cause.printStackTrace(s); |