Author: jim.ma
Date: 2011-06-22 04:58:49 -0400 (Wed, 22 Jun 2011)
New Revision: 14601
Added:
api/trunk/src/main/java/org/jboss/ws/api/handler/Message.properties
api/trunk/src/main/java/org/jboss/ws/api/tools/Message.properties
Modified:
api/trunk/src/main/java/org/jboss/ws/api/annotation/Message.properties
api/trunk/src/main/java/org/jboss/ws/api/annotation/TransportGuarantee.java
api/trunk/src/main/java/org/jboss/ws/api/handler/GenericHandler.java
api/trunk/src/main/java/org/jboss/ws/api/tools/SecurityActions.java
api/trunk/src/main/java/org/jboss/ws/api/util/DOMUtils.java
api/trunk/src/main/java/org/jboss/ws/api/util/Message.properties
api/trunk/src/main/java/org/jboss/ws/api/util/ServiceLoader.java
Log:
[JBWS-3316]:i18n execption message
Modified: api/trunk/src/main/java/org/jboss/ws/api/annotation/Message.properties
===================================================================
--- api/trunk/src/main/java/org/jboss/ws/api/annotation/Message.properties 2011-06-22
08:06:38 UTC (rev 14600)
+++ api/trunk/src/main/java/org/jboss/ws/api/annotation/Message.properties 2011-06-22
08:58:49 UTC (rev 14601)
@@ -1,2 +1,3 @@
+ILLEGAL_TRANSPORT_GUARANTEE=Illegal transport guarantee value: {0}
NON_STANDARD_METHOD=Non-standard auth method value : {0}
-ILLEGAL_AUTH_METHOD= Illegal auth method : {0}
\ No newline at end of file
+ILLEGAL_AUTH_METHOD= Illegal auth method : {0}
Modified: api/trunk/src/main/java/org/jboss/ws/api/annotation/TransportGuarantee.java
===================================================================
--- api/trunk/src/main/java/org/jboss/ws/api/annotation/TransportGuarantee.java 2011-06-22
08:06:38 UTC (rev 14600)
+++ api/trunk/src/main/java/org/jboss/ws/api/annotation/TransportGuarantee.java 2011-06-22
08:58:49 UTC (rev 14601)
@@ -21,6 +21,10 @@
*/
package org.jboss.ws.api.annotation;
+import java.util.ResourceBundle;
+
+import org.jboss.ws.api.util.BundleUtils;
+
/**
* The transportGuarantee specifies that the communication
* between client and server should be NONE, INTEGRAL, or
@@ -37,6 +41,7 @@
*/
public final class TransportGuarantee
{
+ private static final ResourceBundle bundle =
BundleUtils.getBundle(TransportGuarantee.class);
/**
* Application does not require any transport guarantees.
@@ -89,7 +94,7 @@
}
}
- throw new IllegalArgumentException("Illegal transport guarantee value: "
+ s);
+ throw new IllegalArgumentException(BundleUtils.getMessage(bundle,
"ILLEGAL_TRANSPORT_GUARANTEE", s));
}
}
Modified: api/trunk/src/main/java/org/jboss/ws/api/handler/GenericHandler.java
===================================================================
--- api/trunk/src/main/java/org/jboss/ws/api/handler/GenericHandler.java 2011-06-22
08:06:38 UTC (rev 14600)
+++ api/trunk/src/main/java/org/jboss/ws/api/handler/GenericHandler.java 2011-06-22
08:58:49 UTC (rev 14601)
@@ -21,9 +21,13 @@
*/
package org.jboss.ws.api.handler;
+import java.util.ResourceBundle;
+
import javax.xml.ws.handler.Handler;
import javax.xml.ws.handler.MessageContext;
+import org.jboss.ws.api.util.BundleUtils;
+
/**
* A generic JAX-WS handler
*
@@ -32,6 +36,7 @@
*/
public abstract class GenericHandler implements Handler
{
+ private static final ResourceBundle bundle =
BundleUtils.getBundle(GenericHandler.class);
private String handlerName;
public String getHandlerName()
@@ -48,7 +53,7 @@
{
Boolean outbound =
(Boolean)msgContext.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
if (outbound == null)
- throw new IllegalStateException("Cannot obtain required property: " +
MessageContext.MESSAGE_OUTBOUND_PROPERTY);
+ throw new IllegalStateException(BundleUtils.getMessage(bundle,
"CANNOT_OBTAIN_REQUIRED_PROPERTY", MessageContext.MESSAGE_OUTBOUND_PROPERTY));
return outbound ? handleOutbound(msgContext) : handleInbound(msgContext);
}
Added: api/trunk/src/main/java/org/jboss/ws/api/handler/Message.properties
===================================================================
--- api/trunk/src/main/java/org/jboss/ws/api/handler/Message.properties
(rev 0)
+++ api/trunk/src/main/java/org/jboss/ws/api/handler/Message.properties 2011-06-22
08:58:49 UTC (rev 14601)
@@ -0,0 +1 @@
+CANNOT_OBTAIN_REQUIRED_PROPERTY=Cannot obtain required property: {0}
Added: api/trunk/src/main/java/org/jboss/ws/api/tools/Message.properties
===================================================================
--- api/trunk/src/main/java/org/jboss/ws/api/tools/Message.properties
(rev 0)
+++ api/trunk/src/main/java/org/jboss/ws/api/tools/Message.properties 2011-06-22 08:58:49
UTC (rev 14601)
@@ -0,0 +1,2 @@
+ERROR_SETTING_CONTEXT_CLASSLOADER=Error setting context classloader
+ERROR_RUNNING_PRIVILEGED_ACTION=Error running privileged action
Modified: api/trunk/src/main/java/org/jboss/ws/api/tools/SecurityActions.java
===================================================================
--- api/trunk/src/main/java/org/jboss/ws/api/tools/SecurityActions.java 2011-06-22
08:06:38 UTC (rev 14600)
+++ api/trunk/src/main/java/org/jboss/ws/api/tools/SecurityActions.java 2011-06-22
08:58:49 UTC (rev 14601)
@@ -25,7 +25,10 @@
import java.security.PrivilegedAction;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
+import java.util.ResourceBundle;
+import org.jboss.ws.api.util.BundleUtils;
+
/**
* Security actions for this package
*
@@ -35,6 +38,7 @@
*/
class SecurityActions
{
+ private static final ResourceBundle bundle =
BundleUtils.getBundle(SecurityActions.class);
/**
* Get context classloader.
*
@@ -98,14 +102,14 @@
}
catch (Throwable e)
{
- throw new RuntimeException("Error setting context
classloader", e);
+ throw new RuntimeException(BundleUtils.getMessage(bundle,
"ERROR_SETTING_CONTEXT_CLASSLOADER"), e);
}
}
});
}
catch (PrivilegedActionException e)
{
- throw new RuntimeException("Error running privileged action",
e.getCause());
+ throw new RuntimeException(BundleUtils.getMessage(bundle,
"ERROR_RUNNING_PRIVILEGED_ACTION"), e.getCause());
}
}
}
Modified: api/trunk/src/main/java/org/jboss/ws/api/util/DOMUtils.java
===================================================================
--- api/trunk/src/main/java/org/jboss/ws/api/util/DOMUtils.java 2011-06-22 08:06:38 UTC
(rev 14600)
+++ api/trunk/src/main/java/org/jboss/ws/api/util/DOMUtils.java 2011-06-22 08:58:49 UTC
(rev 14601)
@@ -111,7 +111,7 @@
}
if (namespaceURI.equals(""))
- throw new IllegalArgumentException("Cannot find namespace uri for:
" + qualifiedName);
+ throw new IllegalArgumentException(BundleUtils.getMessage(bundle,
"CANNOT_FIND_NAMESPACE_URI_FOR", qualifiedName));
}
else
{
@@ -553,7 +553,7 @@
}
else
{
- throw new RuntimeException("Source type not implemented: " +
source.getClass().getName());
+ throw new RuntimeException(BundleUtils.getMessage(bundle,
"SOURCE_TYPE_NOT_IMPLEMENTED", source.getClass()));
}
return retElement;
Modified: api/trunk/src/main/java/org/jboss/ws/api/util/Message.properties
===================================================================
--- api/trunk/src/main/java/org/jboss/ws/api/util/Message.properties 2011-06-22 08:06:38
UTC (rev 14600)
+++ api/trunk/src/main/java/org/jboss/ws/api/util/Message.properties 2011-06-22 08:58:49
UTC (rev 14601)
@@ -1 +1,5 @@
-CAN_NOT_PARSE = Cannot parse: {0}
\ No newline at end of file
+CANNOT_FIND_NAMESPACE_URI_FOR=Cannot find namespace uri for: {0}
+SOURCE_TYPE_NOT_IMPLEMENTED=Source type not implemented: {0}
+FAILED_TO_LOAD=Failed to load {0}: {1}
+CANNOT_LOAD_PROPERTIES=Cannot load properties: {0}
+CAN_NOT_PARSE = Cannot parse: {0}
Modified: api/trunk/src/main/java/org/jboss/ws/api/util/ServiceLoader.java
===================================================================
--- api/trunk/src/main/java/org/jboss/ws/api/util/ServiceLoader.java 2011-06-22 08:06:38
UTC (rev 14600)
+++ api/trunk/src/main/java/org/jboss/ws/api/util/ServiceLoader.java 2011-06-22 08:58:49
UTC (rev 14601)
@@ -32,6 +32,7 @@
import java.util.Collections;
import java.util.Map;
import java.util.Properties;
+import java.util.ResourceBundle;
import java.util.WeakHashMap;
import java.util.concurrent.ConcurrentHashMap;
@@ -57,6 +58,7 @@
*/
public final class ServiceLoader
{
+ private static final ResourceBundle bundle =
BundleUtils.getBundle(ServiceLoader.class);
/**
* A synchronized weak hash map that keeps factory names retrieved using Service API
(META-INF/services/*) for each classloader.
* Weak keys are used to remove entries when classloaders are garbage collected;
values are service-property-name -> factory name maps.
@@ -155,7 +157,7 @@
}
catch (Throwable t)
{
- throw new IllegalStateException("Failed to load " + propertyName +
": " + factoryName, t);
+ throw new IllegalStateException(BundleUtils.getMessage(bundle,
"FAILED_TO_LOAD", new Object[]{ propertyName, factoryName}), t);
}
return factory;
@@ -205,7 +207,7 @@
}
catch (Throwable t)
{
- throw new IllegalStateException("Failed to load " + propertyName +
": " + factoryName, t);
+ throw new IllegalStateException(BundleUtils.getMessage(bundle,
"FAILED_TO_LOAD", new Object[]{ propertyName , factoryName}), t);
}
}
@@ -248,7 +250,7 @@
}
catch (Throwable t)
{
- throw new IllegalStateException("Failed to load " + propertyName +
": " + factoryName, t);
+ throw new IllegalStateException(BundleUtils.getMessage(bundle,
"FAILED_TO_LOAD", new Object[]{ propertyName , factoryName}), t);
}
}
@@ -269,7 +271,7 @@
}
catch (Throwable t)
{
- throw new IllegalStateException("Failed to load: " +
defaultFactory, t);
+ throw new IllegalStateException(BundleUtils.getMessage(bundle,
"FAILED_TO_LOAD", defaultFactory), t);
}
}
@@ -312,7 +314,7 @@
}
catch (IOException ex)
{
- throw new SecurityException("Cannot load properties: " + filename,
ex);
+ throw new SecurityException(BundleUtils.getMessage(bundle,
"CANNOT_LOAD_PROPERTIES", filename), ex);
}
finally
{