< prev index next >
jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/exception/JAXWSExceptionBase.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 43,75 ****
* localizable message.
*
* @author WS Development Team
*/
public abstract class JAXWSExceptionBase
! extends WebServiceException implements Localizable {
//Don't worry about previous serialVersionUID = 4818235090198755494L;, this class was not serializable before.
private static final long serialVersionUID = 1L;
private transient Localizable msg;
/**
! * @deprecated
! * Should use the localizable constructor instead.
*/
protected JAXWSExceptionBase(String key, Object... args) {
super(findNestedException(args));
! this.msg = new LocalizableMessage(getDefaultResourceBundleName(), key, args);
}
protected JAXWSExceptionBase(String message) {
this(new NullLocalizable(message));
}
/**
* Creates a new exception that wraps the specified exception.
*/
protected JAXWSExceptionBase(Throwable throwable) {
this(new NullLocalizable(throwable.toString()),throwable);
}
--- 43,78 ----
* localizable message.
*
* @author WS Development Team
*/
public abstract class JAXWSExceptionBase
! extends WebServiceException implements Localizable, LocalizableMessageFactory.ResourceBundleSupplier {
//Don't worry about previous serialVersionUID = 4818235090198755494L;, this class was not serializable before.
private static final long serialVersionUID = 1L;
private transient Localizable msg;
/**
! * @param key
! * @param args
! * @deprecated Should use the localizable constructor instead.
*/
+ @Deprecated
protected JAXWSExceptionBase(String key, Object... args) {
super(findNestedException(args));
! this.msg = new LocalizableMessage(getDefaultResourceBundleName(), this, key, args);
}
protected JAXWSExceptionBase(String message) {
this(new NullLocalizable(message));
}
/**
* Creates a new exception that wraps the specified exception.
+ * @param throwable
*/
protected JAXWSExceptionBase(Throwable throwable) {
this(new NullLocalizable(throwable.toString()),throwable);
}
*** 125,136 ****
args = new Object[len];
for (int i = 0; i < args.length; i++) {
args[i] = in.readObject();
}
}
! msg = new LocalizableMessageFactory(resourceBundleName, this::getResourceBundle)
! .getMessage(key,args);
}
private static Throwable findNestedException(Object[] args) {
if (args == null)
return null;
--- 128,138 ----
args = new Object[len];
for (int i = 0; i < args.length; i++) {
args[i] = in.readObject();
}
}
! msg = new LocalizableMessageFactory(resourceBundleName).getMessage(key,args);
}
private static Throwable findNestedException(Object[] args) {
if (args == null)
return null;
*** 139,179 ****
if(o instanceof Throwable)
return (Throwable)o;
return null;
}
public String getMessage() {
Localizer localizer = new Localizer();
return localizer.localize(this);
}
/**
* Gets the default resource bundle name for this kind of exception.
* Used for {@link #JAXWSExceptionBase(String, Object[])}.
*/
protected abstract String getDefaultResourceBundleName();
- /*
- * Returns the ResourceBundle in this module.
- *
- * Subclasses in a different module has to override this method.
- */
- @Override
- public ResourceBundle getResourceBundle(Locale locale) {
- return ResourceBundle.getBundle(getDefaultResourceBundleName(), locale);
- }
-
//
// Localizable delegation
//
public final String getKey() {
return msg.getKey();
}
public final Object[] getArguments() {
return msg.getArguments();
}
public final String getResourceBundleName() {
return msg.getResourceBundleName();
}
}
--- 141,182 ----
if(o instanceof Throwable)
return (Throwable)o;
return null;
}
+ @Override
public String getMessage() {
Localizer localizer = new Localizer();
return localizer.localize(this);
}
/**
* Gets the default resource bundle name for this kind of exception.
* Used for {@link #JAXWSExceptionBase(String, Object[])}.
+ * @return
*/
protected abstract String getDefaultResourceBundleName();
//
// Localizable delegation
//
+ @Override
public final String getKey() {
return msg.getKey();
}
+ @Override
public final Object[] getArguments() {
return msg.getArguments();
}
+ @Override
public final String getResourceBundleName() {
return msg.getResourceBundleName();
}
+
+ @Override
+ public ResourceBundle getResourceBundle(Locale locale) {
+ return ResourceBundle.getBundle(getDefaultResourceBundleName(), locale);
+ }
+
}
< prev index next >