--- old/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/exception/JAXWSExceptionBase.java 2017-06-01 18:21:19.761569603 +0100 +++ new/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/exception/JAXWSExceptionBase.java 2017-06-01 18:21:19.709569603 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -45,7 +45,7 @@ * @author WS Development Team */ public abstract class JAXWSExceptionBase - extends WebServiceException implements Localizable { + 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; @@ -53,12 +53,14 @@ private transient Localizable msg; /** - * @deprecated - * Should use the localizable constructor instead. + * @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(), key, args); + this.msg = new LocalizableMessage(getDefaultResourceBundleName(), this, key, args); } @@ -68,6 +70,7 @@ /** * Creates a new exception that wraps the specified exception. + * @param throwable */ protected JAXWSExceptionBase(Throwable throwable) { this(new NullLocalizable(throwable.toString()),throwable); @@ -127,8 +130,7 @@ args[i] = in.readObject(); } } - msg = new LocalizableMessageFactory(resourceBundleName, this::getResourceBundle) - .getMessage(key,args); + msg = new LocalizableMessageFactory(resourceBundleName).getMessage(key,args); } private static Throwable findNestedException(Object[] args) { @@ -141,6 +143,7 @@ return null; } + @Override public String getMessage() { Localizer localizer = new Localizer(); return localizer.localize(this); @@ -149,31 +152,31 @@ /** * Gets the default resource bundle name for this kind of exception. * Used for {@link #JAXWSExceptionBase(String, Object[])}. + * @return */ 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 // + @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); + } + }