[jbossws-commits] JBossWS SVN: r16860 - in stack/native/trunk/modules/core/src/main/java/org/jboss/ws: core/client and 4 other directories.
jbossws-commits at lists.jboss.org
jbossws-commits at lists.jboss.org
Thu Oct 11 12:19:51 EDT 2012
Author: alessio.soldano at jboss.com
Date: 2012-10-11 12:19:51 -0400 (Thu, 11 Oct 2012)
New Revision: 16860
Removed:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client/Message.properties
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server/Message.properties
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/utils/Message.properties
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/NativeLoggers.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/NativeMessages.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client/HTTPRemotingConnection.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client/RemoteConnectionFactory.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client/transport/Message.properties
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client/transport/NettyTransportOutputStream.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client/transport/WSResponseHandler.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server/DelegatingInvocation.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server/PortComponentLinkServlet.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server/PortComponentResolver.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server/WSDLRequestHandler.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/Message.properties
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPPartImpl.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/TextImpl.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/XMLContent.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/utils/HolderUtils.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/utils/MimeUtils.java
Log:
[JBWS-3509] WIP on convertin native messages to new logging...
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/NativeLoggers.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/NativeLoggers.java 2012-10-11 14:38:55 UTC (rev 16859)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/NativeLoggers.java 2012-10-11 16:19:51 UTC (rev 16860)
@@ -190,4 +190,12 @@
@Message(id = 25177, value = "Exception caught while (preparing for) performing invocation")
void exceptionWhilePreparingForInvocation(@Cause Throwable cause);
+ @LogMessage(level = WARN)
+ @Message(id = 25192, value = "Exception while processing handleFault")
+ void exceptionProcessingHandleFault(@Cause Throwable cause);
+
+ @LogMessage(level = WARN)
+ @Message(id = 25193, value = "Multiple service endoints found for: %s")
+ void multipleServiceEndpointFoundFor(String s);
+
}
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/NativeMessages.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/NativeMessages.java 2012-10-11 14:38:55 UTC (rev 16859)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/NativeMessages.java 2012-10-11 16:19:51 UTC (rev 16860)
@@ -31,6 +31,7 @@
import javax.xml.namespace.QName;
import javax.xml.soap.Name;
import javax.xml.soap.SOAPException;
+import javax.xml.transform.Source;
import org.apache.xerces.xni.XNIException;
import org.apache.xerces.xs.XSElementDeclaration;
@@ -42,6 +43,7 @@
import org.jboss.ws.metadata.wsdl.WSDLException;
import org.jboss.ws.metadata.wsdl.WSDLTypes;
import org.jboss.wsf.spi.deployment.Deployment;
+import org.w3c.dom.Node;
/**
* JBossWS-CXF exception messages
@@ -479,4 +481,64 @@
@Message(id = 25176, value = "Target endpoint address not set")
WSException targetEndpointAddressNotSet();
+ @Message(id = 25178, value = "No ByteArrayConverter for %s")
+ WSException noByteArrayConverterFor(String c);
+
+ @Message(id = 25179, value = "Failed to convert %s")
+ WSException failedToConvert(Object o);
+
+ @Message(id = 25180, value = "%s is already a javax.xml.rpc.holders.Holder")
+ IllegalArgumentException alreadyAHolder(String className);
+
+ @Message(id = 25181, value = "%s is not a javax.xml.rpc.holders.Holder")
+ IllegalArgumentException notAHolder(Object holder);
+
+ @Message(id = 25182, value = "Cannot find or access public 'value' field in %s")
+ IllegalArgumentException cannotFindOrAccessPublicFieldValue(Object holder);
+
+ @Message(id = 25183, value = "Holder [%s] value not assignable: %s")
+ IllegalArgumentException holderValueNotAssignable(Object holder, Object value);
+
+ @Message(id = 25184, value = "Object value not available")
+ IllegalStateException objectValueNotAvailable();
+
+ @Message(id = 25185, value = "Content root name does not match element name: %s != %s")
+ WSException doesNotMatchElementName(QName contentRootName, QName elementName);
+
+ @Message(id = 25186, value = "javaType %s is not assignable from: %s")
+ WSException javaTypeIsNotAssignableFrom2(String s1, String s2);
+
+ @Message(id = 25187, value = "The parent element of a soap part is not defined")
+ SOAPException parentElemOfSOAPPartIsNotDefined();
+
+ @Message(id = 25188, value = "Setting value of a soap part is not defined")
+ IllegalStateException settingValueOfSOAPPartIsNotDefined();
+
+ @Message(id = 25189, value = "Unsupported DOMSource node: %s")
+ SOAPException unsupportedDOMSourceNode(Node node);
+
+ @Message(id = 25190, value = "Unsupported source parameter: %s")
+ SOAPException unsupportedSourceParameter(Source s);
+
+ @Message(id = 25191, value = "Access to '%s' resource is not allowed")
+ IOException accessIsNotAllowed(String path);
+
+ @Message(id = 25194, value = "Cannot resolve port-component-link: %s")
+ WSException cannotResolvePortComponentLink(String pcl);
+
+ @Message(id = 25195, value = "Cannot obtain remote connetion for %s")
+ IllegalArgumentException cannotObtainRemoteConnectionFor(Object obj);
+
+ @Message(id = 25196, value = "Cannot obtain target address from %s")
+ IllegalArgumentException cannotObtainTargetAddressFrom(Object obj);
+
+ @Message(id = 25197, value = "Connection is already closed")
+ IOException connectionAlreadyClosed();
+
+ @Message(id = 25198, value = "Invalid chunk size (must be greater than 0): %s")
+ IllegalArgumentException invalidChunkSize(int size);
+
+ @Message(id = 25199, value = "Cannot get channel future before closing the stream")
+ IllegalStateException cannotGetChannelFuture();
+
}
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client/HTTPRemotingConnection.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client/HTTPRemotingConnection.java 2012-10-11 14:38:55 UTC (rev 16859)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client/HTTPRemotingConnection.java 2012-10-11 16:19:51 UTC (rev 16860)
@@ -25,13 +25,12 @@
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
-import java.util.ResourceBundle;
import javax.xml.soap.MimeHeader;
import javax.xml.soap.MimeHeaders;
import javax.xml.soap.SOAPMessage;
-import org.jboss.ws.api.util.BundleUtils;
+import org.jboss.ws.NativeMessages;
import org.jboss.ws.core.MessageTrace;
import org.jboss.ws.core.StubExt;
import org.jboss.ws.core.client.transport.NettyClient;
@@ -52,8 +51,6 @@
*/
public abstract class HTTPRemotingConnection implements RemoteConnection
{
- private static final ResourceBundle bundle = BundleUtils.getBundle(HTTPRemotingConnection.class);
-
private boolean closed;
private Integer chunkSize;
@@ -90,10 +87,10 @@
public SOAPMessage invoke(SOAPMessage reqMessage, Object endpoint, boolean oneway) throws IOException
{
if (endpoint == null)
- throw new IllegalArgumentException(BundleUtils.getMessage(bundle, "GIVEN_ENDPOINT_CANNOT_BE_NULL"));
+ throw NativeMessages.MESSAGES.illegalNullArgument("endpoint");
if (closed)
- throw new IOException(BundleUtils.getMessage(bundle, "CONNECTION_IS_ALREADY_CLOSED"));
+ throw NativeMessages.MESSAGES.connectionAlreadyClosed();
String targetAddress;
Map<String, Object> callProps = new HashMap<String, Object>();
Deleted: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client/Message.properties
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client/Message.properties 2012-10-11 14:38:55 UTC (rev 16859)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client/Message.properties 2012-10-11 16:19:51 UTC (rev 16860)
@@ -1,5 +0,0 @@
-GIVEN_ENDPOINT_CANNOT_BE_NULL=Given endpoint cannot be null
-CONNECTION_IS_ALREADY_CLOSED=Connection is already closed
-GIVEN_ENDPOINT_CANNOT_BE_NULL=Given endpoint cannot be null
-CANNOT_OBTAIN_TARGET_ADDRESS=Cannot obtain target address from: {0}
-CANNOT_OBTAIN_REMOTE_CONNETION=Cannot obtain remote connetion for: {0}
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client/RemoteConnectionFactory.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client/RemoteConnectionFactory.java 2012-10-11 14:38:55 UTC (rev 16859)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client/RemoteConnectionFactory.java 2012-10-11 16:19:51 UTC (rev 16860)
@@ -21,9 +21,7 @@
*/
package org.jboss.ws.core.client;
-import java.util.ResourceBundle;
-
-import org.jboss.ws.api.util.BundleUtils;
+import org.jboss.ws.NativeMessages;
import org.jboss.ws.api.util.ServiceLoader;
/**
@@ -34,12 +32,11 @@
*/
public class RemoteConnectionFactory
{
- private static final ResourceBundle bundle = BundleUtils.getBundle(RemoteConnectionFactory.class);
public RemoteConnection getRemoteConnection(EndpointInfo epInfo)
{
String targetAddress = epInfo.getTargetAddress();
if (targetAddress == null)
- throw new IllegalArgumentException(BundleUtils.getMessage(bundle, "CANNOT_OBTAIN_TARGET_ADDRESS", epInfo));
+ throw NativeMessages.MESSAGES.cannotObtainTargetAddressFrom(epInfo);
String key = null;
targetAddress = targetAddress.toLowerCase();
@@ -47,11 +44,11 @@
key = RemoteConnection.class.getName() + ".http";
if (key == null)
- throw new IllegalArgumentException(BundleUtils.getMessage(bundle, "CANNOT_OBTAIN_REMOTE_CONNETION", targetAddress));
+ throw NativeMessages.MESSAGES.cannotObtainRemoteConnectionFor(targetAddress);
RemoteConnection con = (RemoteConnection)ServiceLoader.loadService(key, null, this.getClass().getClassLoader());
if (con == null)
- throw new IllegalArgumentException(BundleUtils.getMessage(bundle, "CANNOT_OBTAIN_REMOTE_CONNETION", key));
+ throw NativeMessages.MESSAGES.cannotObtainRemoteConnectionFor(key);
return con;
}
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client/transport/Message.properties
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client/transport/Message.properties 2012-10-11 14:38:55 UTC (rev 16859)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client/transport/Message.properties 2012-10-11 16:19:51 UTC (rev 16860)
@@ -1,5 +1,3 @@
-INVALID_CHUNK_SIZE=Invalid chunk size (must be greater than 0)
-CANNOT_GET_CHANNEL=Cannot get channel future before closing the stream.
OPERATION_CANCELLED=Operation Cancelled
TIMEOUT_EXCEEDED=Timeout Exceeded
COULD_NOT_CONNECT_TO=Could not connect to {0}
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client/transport/NettyTransportOutputStream.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client/transport/NettyTransportOutputStream.java 2012-10-11 14:38:55 UTC (rev 16859)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client/transport/NettyTransportOutputStream.java 2012-10-11 16:19:51 UTC (rev 16860)
@@ -23,7 +23,6 @@
import java.io.IOException;
import java.io.OutputStream;
-import java.util.ResourceBundle;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
@@ -31,7 +30,7 @@
import org.jboss.netty.channel.ChannelFuture;
import org.jboss.netty.handler.codec.http.DefaultHttpChunk;
import org.jboss.netty.handler.codec.http.HttpChunk;
-import org.jboss.ws.api.util.BundleUtils;
+import org.jboss.ws.NativeMessages;
/**
* An output stream that sends messages using Netty.
@@ -46,7 +45,6 @@
*/
public class NettyTransportOutputStream extends OutputStream
{
- private static final ResourceBundle bundle = BundleUtils.getBundle(NettyTransportOutputStream.class);
private Channel channel;
private byte[] buffer;
private int cur;
@@ -64,7 +62,7 @@
this.channel = channel;
if (chunkSize <= 0)
{
- throw new IllegalArgumentException(BundleUtils.getMessage(bundle, "INVALID_CHUNK_SIZE"));
+ throw NativeMessages.MESSAGES.invalidChunkSize(chunkSize);
}
this.cur = 0;
this.buffer = new byte[chunkSize];
@@ -155,7 +153,7 @@
{
if (!closed)
{
- throw new IllegalStateException(BundleUtils.getMessage(bundle, "CANNOT_GET_CHANNEL"));
+ throw NativeMessages.MESSAGES.cannotGetChannelFuture();
}
return future;
}
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client/transport/WSResponseHandler.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client/transport/WSResponseHandler.java 2012-10-11 14:38:55 UTC (rev 16859)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client/transport/WSResponseHandler.java 2012-10-11 16:19:51 UTC (rev 16860)
@@ -24,7 +24,6 @@
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
-import java.util.ResourceBundle;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
@@ -41,7 +40,6 @@
import org.jboss.netty.channel.SimpleChannelUpstreamHandler;
import org.jboss.netty.handler.codec.http.HttpResponse;
import org.jboss.netty.handler.codec.http.HttpResponseStatus;
-import org.jboss.ws.api.util.BundleUtils;
/**
* A Netty channel upstream handler that receives MessageEvent
@@ -53,7 +51,6 @@
@Sharable
public class WSResponseHandler extends SimpleChannelUpstreamHandler
{
- private static final ResourceBundle bundle = BundleUtils.getBundle(WSResponseHandler.class);
private FutureResult future;
public WSResponseHandler()
@@ -180,7 +177,7 @@
}
if (cancelled)
{
- throw new InterruptedException(BundleUtils.getMessage(bundle, "OPERATION_CANCELLED"));
+ throw new InterruptedException();
}
if (exception != null)
{
@@ -200,11 +197,11 @@
}
if (cancelled)
{
- throw new InterruptedException(BundleUtils.getMessage(bundle, "OPERATION_CANCELLED"));
+ throw new InterruptedException();
}
if (!done)
{
- throw new TimeoutException(BundleUtils.getMessage(bundle, "TIMEOUT_EXCEEDED"));
+ throw new TimeoutException();
}
if (exception != null)
{
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server/DelegatingInvocation.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server/DelegatingInvocation.java 2012-10-11 14:38:55 UTC (rev 16859)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server/DelegatingInvocation.java 2012-10-11 16:19:51 UTC (rev 16860)
@@ -21,13 +21,10 @@
*/
package org.jboss.ws.core.server;
-import java.util.ResourceBundle;
-
import javax.xml.rpc.handler.soap.SOAPMessageContext;
import javax.xml.soap.SOAPMessage;
import org.jboss.ws.WSException;
-import org.jboss.ws.api.util.BundleUtils;
import org.jboss.ws.core.CommonBinding;
import org.jboss.ws.core.CommonBindingProvider;
import org.jboss.ws.core.EndpointInvocation;
@@ -42,14 +39,9 @@
*/
public class DelegatingInvocation extends Invocation
{
- private static final ResourceBundle bundle = BundleUtils.getBundle(DelegatingInvocation.class);
private EndpointInvocation getEndpointInvocation()
{
- EndpointInvocation epInv = getInvocationContext().getAttachment(EndpointInvocation.class);
- if (epInv == null)
- throw new IllegalStateException(BundleUtils.getMessage(bundle, "CANNOT_OBTAIN_ENDPOINT_INVOCATION"));
-
- return epInv;
+ return getInvocationContext().getAttachment(EndpointInvocation.class);
}
@Override
@@ -94,6 +86,6 @@
@Override
public void setArgs(Object[] args)
{
- throw new IllegalArgumentException(BundleUtils.getMessage(bundle, "CANNOT_SET_ARGS"));
+ throw new UnsupportedOperationException();
}
}
Deleted: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server/Message.properties
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server/Message.properties 2012-10-11 14:38:55 UTC (rev 16859)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server/Message.properties 2012-10-11 16:19:51 UTC (rev 16860)
@@ -1,17 +0,0 @@
-CANNOT_OBTAIN_PCLINK=Cannot obtain request parameter 'pcLink'
-CANNOT_RESOLVE_PORT_COMPONENT_LINK=Cannot resolve port-component-link: {0}
-CANNOT_OBTAIN_WSDL_LOCATION=Cannot obtain wsdl location
-ACCESS_IS_NOT_ALLOWED=Access to '{0}' resource is not allowed
-SKIPPING_REWRITE_OF_INVALID_ADDRESS=Skipping rewrite of invalid address: {0}
-CANNOT_OBTAIN_ENDPOINT_INVOCATION=Cannot obtain endpoint invocation
-CANNOT_SET_ARGS=Cannot set args on this invocation
-
-CANNOT_OBTAIN_ENDPOINT_META_DATA=Cannot obtain endpoint meta data
-RPC/LITERAL_PAPAMETERS_IS_NULL=The RPC/Literal Operation [{0} ] parameters can not be null
-EXCEPTION_PROCESSING_HANDLEFAULT=Exception while processing handleFault:
-CANNOT_PROVIDE_WEBSERVICECONTEXT=Cannot provide WebServiceContext, since the current MessageContext does not provide a ServletRequest
-CANNOT_CREATE_ENDPOINT_INSTANCE=Cannot create endpoint instance
-CODESOURCE=CodeSource: {0}
-CLASSLOADER=ClassLoader: {0}
-MULTIPLE_OPERATIONS_NOT_SUPPORTED=Multiple operations not supported for HTTP binding
-MULTIPLE_SERVICE_ENDOINTS_FOUND=Multiple service endoints found for: {0}
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server/PortComponentLinkServlet.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server/PortComponentLinkServlet.java 2012-10-11 14:38:55 UTC (rev 16859)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server/PortComponentLinkServlet.java 2012-10-11 16:19:51 UTC (rev 16860)
@@ -23,7 +23,6 @@
import java.io.IOException;
import java.io.PrintWriter;
-import java.util.ResourceBundle;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
@@ -32,8 +31,7 @@
import javax.servlet.http.HttpServletResponse;
import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.ws.api.util.BundleUtils;
+import org.jboss.ws.NativeMessages;
import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
import org.jboss.wsf.spi.SPIProvider;
import org.jboss.wsf.spi.SPIProviderResolver;
@@ -58,7 +56,6 @@
*/
public class PortComponentLinkServlet extends HttpServlet
{
- private static final ResourceBundle bundle = BundleUtils.getBundle(PortComponentLinkServlet.class);
// provide logging
private static final Logger log = Logger.getLogger(PortComponentLinkServlet.class);
@@ -78,11 +75,11 @@
{
String pcLink = req.getParameter("pcLink");
if (pcLink == null)
- throw new IllegalArgumentException(BundleUtils.getMessage(bundle, "CANNOT_OBTAIN_PCLINK"));
+ throw NativeMessages.MESSAGES.illegalNullArgument("pcLink");
Endpoint endpoint = epRegistry.resolve( new PortComponentResolver(pcLink) );
if (endpoint == null)
- throw new WSException(BundleUtils.getMessage(bundle, "CANNOT_RESOLVE_PORT_COMPONENT_LINK", pcLink));
+ throw NativeMessages.MESSAGES.cannotResolvePortComponentLink(pcLink);
res.setContentType("text/plain");
PrintWriter out = res.getWriter();
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server/PortComponentResolver.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server/PortComponentResolver.java 2012-10-11 14:38:55 UTC (rev 16859)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server/PortComponentResolver.java 2012-10-11 16:19:51 UTC (rev 16860)
@@ -22,10 +22,8 @@
package org.jboss.ws.core.server;
import java.util.Iterator;
-import java.util.ResourceBundle;
-import org.jboss.logging.Logger;
-import org.jboss.ws.api.util.BundleUtils;
+import org.jboss.ws.NativeLoggers;
import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
import org.jboss.wsf.spi.deployment.Endpoint;
import org.jboss.wsf.spi.management.EndpointResolver;
@@ -36,9 +34,6 @@
*/
public class PortComponentResolver implements EndpointResolver
{
- private static final ResourceBundle bundle = BundleUtils.getBundle(PortComponentResolver.class);
- private static final Logger log = Logger.getLogger(PortComponentResolver.class);
-
private String pcLink;
public PortComponentResolver(String pcref)
@@ -65,7 +60,7 @@
{
if (endpoint != null)
{
- log.warn(BundleUtils.getMessage(bundle, "MULTIPLE_SERVICE_ENDOINTS_FOUND", pcLink));
+ NativeLoggers.ROOT_LOGGER.multipleServiceEndpointFoundFor(pcLink);
endpoint = null;
break;
}
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java 2012-10-11 14:38:55 UTC (rev 16859)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java 2012-10-11 16:19:51 UTC (rev 16860)
@@ -24,7 +24,6 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.UndeclaredThrowableException;
-import java.util.ResourceBundle;
import javax.xml.namespace.QName;
import javax.xml.rpc.server.ServiceLifecycle;
@@ -36,7 +35,8 @@
import javax.xml.soap.SOAPMessage;
import org.jboss.logging.Logger;
-import org.jboss.ws.api.util.BundleUtils;
+import org.jboss.ws.NativeLoggers;
+import org.jboss.ws.NativeMessages;
import org.jboss.ws.common.Constants;
import org.jboss.ws.common.JavaUtils;
import org.jboss.ws.core.CommonBinding;
@@ -70,7 +70,6 @@
*/
public class ServiceEndpointInvoker
{
- private static final ResourceBundle bundle = BundleUtils.getBundle(ServiceEndpointInvoker.class);
// provide logging
private static final Logger log = Logger.getLogger(ServiceEndpointInvoker.class);
@@ -85,7 +84,7 @@
ServerEndpointMetaData sepMetaData = endpoint.getAttachment(ServerEndpointMetaData.class);
if (sepMetaData == null)
- throw new IllegalStateException(BundleUtils.getMessage(bundle, "CANNOT_OBTAIN_ENDPOINT_META_DATA"));
+ throw NativeMessages.MESSAGES.cannotObtainEndpointMetaData(endpoint);
bindingProvider = new CommonBindingProvider(sepMetaData);
delegate = new HandlerDelegateJAXRPC(sepMetaData);
@@ -240,7 +239,7 @@
}
catch (RuntimeException subEx)
{
- log.warn(BundleUtils.getMessage(bundle, "EXCEPTION_PROCESSING_HANDLEFAULT"), ex);
+ NativeLoggers.ROOT_LOGGER.exceptionProcessingHandleFault(ex);
binding.bindFaultMessage(subEx);
ex = subEx;
}
@@ -289,7 +288,7 @@
}
catch (Exception ex)
{
- throw new IllegalStateException(BundleUtils.getMessage(bundle, "CANNOT_CREATE_ENDPOINT_INSTANCE"), ex);
+ throw new IllegalStateException(ex);
}
}
}
@@ -321,8 +320,6 @@
}
catch (NoSuchMethodException ex)
{
- log.error(BundleUtils.getMessage(bundle, "CODESOURCE", implClass.getProtectionDomain().getCodeSource()));
- log.error(BundleUtils.getMessage(bundle, "CLASSLOADER", implClass.getClassLoader()));
throw ex;
}
}
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server/WSDLRequestHandler.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server/WSDLRequestHandler.java 2012-10-11 14:38:55 UTC (rev 16859)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server/WSDLRequestHandler.java 2012-10-11 16:19:51 UTC (rev 16860)
@@ -27,10 +27,9 @@
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
-import java.util.ResourceBundle;
import org.jboss.logging.Logger;
-import org.jboss.ws.api.util.BundleUtils;
+import org.jboss.ws.NativeMessages;
import org.jboss.ws.common.DOMUtils;
import org.jboss.wsf.spi.management.ServerConfig;
import org.w3c.dom.Attr;
@@ -54,7 +53,6 @@
*/
public class WSDLRequestHandler
{
- private static final ResourceBundle bundle = BundleUtils.getBundle(WSDLRequestHandler.class);
// provide logging
private static Logger log = Logger.getLogger(WSDLRequestHandler.class);
@@ -64,6 +62,8 @@
public WSDLRequestHandler(URL wsdlLocationFromMetadata, String wsdlPublishLocationFromMetadata, ServerConfig config)
{
+ if (wsdlLocationFromMetadata == null)
+ throw NativeMessages.MESSAGES.illegalNullArgument("wsdlLocationFromMetadata");
this.wsdlLocation = wsdlLocationFromMetadata;
this.wsdlPublishLoc = wsdlPublishLocationFromMetadata;
this.config = config;
@@ -104,10 +104,6 @@
private Document getDocumentForPath(URL reqURL, String wsdlHost, boolean rewriteUsingCalledURL, String resPath) throws IOException
{
Document wsdlDoc;
-
- if (wsdlLocation == null)
- throw new IllegalStateException(BundleUtils.getMessage(bundle, "CANNOT_OBTAIN_WSDL_LOCATION"));
-
// get the root wsdl
if (resPath == null)
{
@@ -156,7 +152,7 @@
}
else
{
- throw new IOException(BundleUtils.getMessage(bundle, "ACCESS_IS_NOT_ALLOWED", resourceAbsPath ));
+ throw NativeMessages.MESSAGES.accessIsNotAllowed(resourceAbsPath);
}
}
@@ -315,13 +311,13 @@
}
else
{
- log.info("Skipping rewrite of non-http address: " + orgLocation);
+ log.debug("Skipping rewrite of non-http address: " + orgLocation);
return false;
}
}
catch (URISyntaxException e)
{
- log.error(BundleUtils.getMessage(bundle, "SKIPPING_REWRITE_OF_INVALID_ADDRESS", orgLocation), e);
+ log.debug("Skipping rewrite of non-http address: " + orgLocation);
return false;
}
}
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/Message.properties
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/Message.properties 2012-10-11 14:38:55 UTC (rev 16859)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/Message.properties 2012-10-11 16:19:51 UTC (rev 16860)
@@ -53,13 +53,10 @@
UNSUPPORTED_ENCODING_STYLE=Unsupported encoding style: {0}
CANNOT_UNMARSHALL_SOAPMESSAGE=Cannot unmarshall SOAPMessage
-CANNOT_EXPAND_CONTAINER_CHILDREN=Cannot expand container children
ILLEGAL_STATE_REQUESTED=Illegal state requested: {0}
OBJECT_VALUE_NOT_AVAILABLE=Object value not available
MESSAGECONTEXT_NOT_AVAILABLE=MessageContext not available
-JAVA_TYPE_NOT_ASSIGNABLE=Java type '{0}' is not assignable from: {1}
CANNOT_OBTAIN_DESERIALIZER_FACTORY=Cannot obtain deserializer factory for: [xmlType={0},javaType={1}]
-DOES_NOT_MATCH_ELEMENT_NAME=Content root name does not match element name: {0} != {1}
EMPTY_SOAP_BODY_NOT_SUPPORTED=Empty SOAP body with no child element not supported for RPC
NOT_A_SOAPMESSAGE=Not a SOAPMessage: {0}
@@ -83,11 +80,7 @@
ALREADY_CONTAINS_DETAIL=this fault already contains a detail element
UNABLE_TO_CREATE_FAULT_DETAIL=Unable to create fault detail: {0}
NOT_A_SOAPMESSAGE=Not a SOAPMessage: {0}
-UNSUPPORTED_DOMSOURCE_NODE=Unsupported DOMSource node: {0}
CANNOT_PARSE_STREAM_SOURCE=Cannot parse stream source
-UNSUPPORTED_SOURCE_PARAMETER=Unsupported source parameter: {0}
-THE_PARENT_ELEMENT_NOT_DEFINED=The parent element of a soap part is not defined
-SETTING_VALUE_NOT_DEFINED=Setting value of a soap part is not defined
VALIDATION_ERROR=Validation error: Cannot obtain wsdl URL
SOAP11_NOT_SUPPORT_ROLE=SOAP 1.1 does not support the concept of Role
INVALID_NULL_PARENT_ELEMENT=Invalid null parent element
@@ -103,7 +96,6 @@
CANNOT_DECODE_NAME=Cannot decode name for cid: {0}
IGNORE_SOAPEXCEPTION=Ignore SOAPException: {0}
MIMEHEADERS_CANNOT_BE_NULL=MimeHeaders cannot be null
-INVALID_OFFSET=Invalid offset [{0}] for '{1}'
ILLEGAL_STATE_REQUESTED=Illegal state requested: {0}
PAYLOAD_NOT_AVAILABLE=Payload not available
PAYLOAD_CANNOT_BE_SET_ON_OBJECT_CONTENT=Payload cannot be set on object content
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPPartImpl.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPPartImpl.java 2012-10-11 14:38:55 UTC (rev 16859)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPPartImpl.java 2012-10-11 16:19:51 UTC (rev 16860)
@@ -27,7 +27,6 @@
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-import java.util.ResourceBundle;
import javax.xml.soap.MimeHeaders;
import javax.xml.soap.SOAPElement;
@@ -40,7 +39,7 @@
import javax.xml.transform.stream.StreamSource;
import org.jboss.logging.Logger;
-import org.jboss.ws.api.util.BundleUtils;
+import org.jboss.ws.NativeMessages;
import org.jboss.ws.api.util.ServiceLoader;
import org.jboss.ws.core.soap.utils.Style;
import org.w3c.dom.Attr;
@@ -68,7 +67,6 @@
*/
public class SOAPPartImpl extends SOAPPart
{
- private static final ResourceBundle bundle = BundleUtils.getBundle(SOAPPartImpl.class);
// provide logging
private static Logger log = Logger.getLogger(SOAPPartImpl.class);
@@ -171,7 +169,7 @@
else if (node instanceof Element)
domElement = (Element)node;
else
- throw new SOAPException(BundleUtils.getMessage(bundle, "UNSUPPORTED_DOMSOURCE_NODE", node));
+ throw NativeMessages.MESSAGES.unsupportedDOMSourceNode(node);
EnvelopeBuilder envBuilder = (EnvelopeBuilder) ServiceLoader.loadService(EnvelopeBuilder.class.getName(), EnvelopeBuilderDOM.class.getName());
envBuilder.setStyle(Style.DOCUMENT);
@@ -193,12 +191,12 @@
}
catch (IOException e)
{
- throw new SOAPException(BundleUtils.getMessage(bundle, "CANNOT_PARSE_STREAM_SOURCE"), e);
+ throw new SOAPException(e);
}
}
else
{
- throw new SOAPException(BundleUtils.getMessage(bundle, "UNSUPPORTED_SOURCE_PARAMETER", source));
+ throw NativeMessages.MESSAGES.unsupportedSourceParameter(source);
}
}
@@ -578,12 +576,12 @@
public void setParentElement(SOAPElement parent) throws SOAPException
{
- throw new SOAPException(BundleUtils.getMessage(bundle, "THE_PARENT_ELEMENT_NOT_DEFINED"));
+ throw NativeMessages.MESSAGES.parentElemOfSOAPPartIsNotDefined();
}
public void setValue(String value)
{
- throw new IllegalStateException(BundleUtils.getMessage(bundle, "SETTING_VALUE_NOT_DEFINED"));
+ throw NativeMessages.MESSAGES.settingValueOfSOAPPartIsNotDefined();
}
}
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/TextImpl.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/TextImpl.java 2012-10-11 14:38:55 UTC (rev 16859)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/TextImpl.java 2012-10-11 16:19:51 UTC (rev 16860)
@@ -23,9 +23,7 @@
import java.io.IOException;
import java.io.Writer;
-import java.util.ResourceBundle;
-import org.jboss.ws.api.util.BundleUtils;
import org.w3c.dom.DOMException;
import org.w3c.dom.Text;
@@ -37,8 +35,6 @@
*/
public class TextImpl extends NodeImpl implements javax.xml.soap.Text
{
- private static final ResourceBundle bundle = BundleUtils.getBundle(TextImpl.class);
-
public TextImpl(org.w3c.dom.Node node)
{
super(node);
@@ -88,7 +84,7 @@
{
if (offset < 0 || offset > getNodeValue().length())
- throw new IllegalArgumentException(BundleUtils.getMessage(bundle, "INVALID_OFFSET", new Object[]{offset, getNodeValue()}));
+ throw new IllegalArgumentException("Invalid offset [" + offset + "] for '" + getNodeValue() + "'");
String before = getNodeValue().substring(0, offset + 1);
setNodeValue(before);
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/XMLContent.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/XMLContent.java 2012-10-11 14:38:55 UTC (rev 16859)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/XMLContent.java 2012-10-11 16:19:51 UTC (rev 16860)
@@ -23,15 +23,14 @@
import java.lang.reflect.Array;
import java.lang.reflect.Method;
-import java.util.ResourceBundle;
import javax.xml.namespace.QName;
import javax.xml.soap.SOAPElement;
import javax.xml.soap.SOAPException;
import org.jboss.logging.Logger;
+import org.jboss.ws.NativeMessages;
import org.jboss.ws.WSException;
-import org.jboss.ws.api.util.BundleUtils;
import org.jboss.ws.common.DOMUtils;
import org.jboss.ws.common.JavaUtils;
import org.jboss.ws.core.CommonMessageContext;
@@ -59,7 +58,6 @@
*/
class XMLContent extends SOAPContent
{
- private static final ResourceBundle bundle = BundleUtils.getBundle(XMLContent.class);
private static final Logger log = Logger.getLogger(XMLContent.class);
// The well formed XML content of this element.
@@ -99,13 +97,13 @@
}
catch (SOAPException ex)
{
- throw new WSException(BundleUtils.getMessage(bundle, "CANNOT_EXPAND_CONTAINER_CHILDREN"), ex);
+ throw new WSException(ex);
}
next = new DOMContent(container);
}
else
{
- throw new IllegalArgumentException(BundleUtils.getMessage(bundle, "ILLEGAL_STATE_REQUESTED", nextState));
+ throw new IllegalArgumentException("Illegal state requested " + nextState);
}
return next;
@@ -123,12 +121,12 @@
public Object getObjectValue()
{
- throw new IllegalStateException(BundleUtils.getMessage(bundle, "OBJECT_VALUE_NOT_AVAILABLE"));
+ throw NativeMessages.MESSAGES.objectValueNotAvailable();
}
public void setObjectValue(Object objValue)
{
- throw new IllegalStateException(BundleUtils.getMessage(bundle, "OBJECT_VALUE_NOT_AVAILABLE"));
+ throw NativeMessages.MESSAGES.objectValueNotAvailable();
}
private Object unmarshallObjectContents()
@@ -143,8 +141,7 @@
log.debug("getObjectValue [xmlType=" + xmlType + ",javaType=" + javaType + "]");
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
- if (msgContext == null)
- throw new WSException(BundleUtils.getMessage(bundle, "MESSAGECONTEXT_NOT_AVAILABLE"));
+ assert(msgContext != null);
SerializationContext serContext = msgContext.getSerializationContext();
ParameterMetaData pmd = container.getParamMetaData();
@@ -199,7 +196,7 @@
{
if (!JavaUtils.isAssignableFrom(javaType, obj.getClass()))
{
- throw new WSException(BundleUtils.getMessage(bundle, "JAVA_TYPE_NOT_ASSIGNABLE", new Object[]{ javaType , objType.getName()}));
+ throw NativeMessages.MESSAGES.javaTypeIsNotAssignableFrom2(javaType.toString(), objType.getName());
}
}
}
@@ -242,9 +239,6 @@
}
}
- if (deserializerFactory == null)
- throw new WSException(BundleUtils.getMessage(bundle, "CANNOT_OBTAIN_DESERIALIZER_FACTORY", new Object[]{ xmlType , javaType}));
-
return deserializerFactory;
}
@@ -265,7 +259,7 @@
boolean artificalElement = (SOAPContentElement.GENERIC_PARAM_NAME.equals(qname) || SOAPContentElement.GENERIC_RETURN_NAME.equals(qname));
if (!artificalElement && !contentRootName.equals(qname))
- throw new WSException(BundleUtils.getMessage(bundle, "DOES_NOT_MATCH_ELEMENT_NAME", new Object[]{ contentRootName , qname}));
+ throw NativeMessages.MESSAGES.doesNotMatchElementName(contentRootName, qname);
// Remove all child nodes
container.removeContents();
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/utils/HolderUtils.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/utils/HolderUtils.java 2012-10-11 14:38:55 UTC (rev 16859)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/utils/HolderUtils.java 2012-10-11 16:19:51 UTC (rev 16860)
@@ -21,12 +21,13 @@
*/
package org.jboss.ws.core.utils;
+import static org.jboss.ws.NativeMessages.MESSAGES;
+
import java.lang.reflect.Field;
import java.lang.reflect.Type;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Calendar;
-import java.util.ResourceBundle;
import javax.xml.namespace.QName;
import javax.xml.rpc.holders.BigDecimalHolder;
@@ -51,8 +52,6 @@
import javax.xml.rpc.holders.ShortWrapperHolder;
import javax.xml.rpc.holders.StringHolder;
-import org.jboss.logging.Logger;
-import org.jboss.ws.api.util.BundleUtils;
import org.jboss.ws.common.JavaUtils;
/**
@@ -65,11 +64,8 @@
*/
public class HolderUtils
{
- private static final ResourceBundle bundle = BundleUtils.getBundle(HolderUtils.class);
- private static final Logger log = Logger.getLogger(HolderUtils.class);
-
/** True if the given type is a holder. */
- public static boolean isHolderType(Class javaType)
+ public static boolean isHolderType(Class<?> javaType)
{
return javax.xml.rpc.holders.Holder.class.isAssignableFrom(javaType);
}
@@ -86,13 +82,13 @@
* @param valueType the value
* @return the holder, or null if there is no match
*/
- public static Class getJAXRPCHolderType(Class valueType)
+ public static Class<?> getJAXRPCHolderType(Class<?> valueType)
{
if (valueType == null)
- throw new IllegalArgumentException(BundleUtils.getMessage(bundle, "ILLEGAL_NULL_PARAMETER"));
+ throw MESSAGES.illegalNullArgument("valueType");
if (javax.xml.rpc.holders.Holder.class.isAssignableFrom(valueType))
- throw new IllegalArgumentException(BundleUtils.getMessage(bundle, "ALREADY_A_HOLDER", valueType.getName()));
+ throw MESSAGES.alreadyAHolder(valueType.getName());
if (valueType == BigDecimal.class)
return BigDecimalHolder.class;
@@ -137,8 +133,6 @@
if (valueType == Object.class)
return ObjectHolder.class;
- log.warn(BundleUtils.getMessage(bundle, "CANNOT_GET_HOLDER_TYPE", valueType));
-
return null;
}
@@ -154,7 +148,7 @@
boolean jaxrpcHolder = javax.xml.rpc.holders.Holder.class.isAssignableFrom(holderClass);
if (!jaxrpcHolder)
- throw new IllegalArgumentException(BundleUtils.getMessage(bundle, "IS_NOT_A_HOLDER", holderClass.getName()));
+ throw MESSAGES.notAHolder(holderClass.getName());
// Holder is supposed to have a public value field.
Field field;
@@ -164,7 +158,7 @@
}
catch (NoSuchFieldException e)
{
- throw new IllegalArgumentException(BundleUtils.getMessage(bundle, "CANNOT_FIND_PUBLIC_VALUE_FIELD", holderClass));
+ throw MESSAGES.cannotFindOrAccessPublicFieldValue(holderClass);
}
return field.getType();
@@ -182,7 +176,7 @@
{
boolean jaxrpcHolder = javax.xml.rpc.holders.Holder.class.isAssignableFrom(holderClass);
if (!jaxrpcHolder)
- throw new IllegalArgumentException(BundleUtils.getMessage(bundle, "IS_NOT_A_HOLDER", holderClass.getName()));
+ throw MESSAGES.notAHolder(holderClass.getName());
// Holder is supposed to have a public value field.
Field field;
@@ -192,7 +186,7 @@
}
catch (NoSuchFieldException e)
{
- throw new IllegalArgumentException(BundleUtils.getMessage(bundle, "CANNOT_FIND_PUBLIC_VALUE_FIELD", holderClass));
+ throw MESSAGES.cannotFindOrAccessPublicFieldValue(holderClass);
}
return field.getType();
@@ -207,10 +201,10 @@
public static Object getHolderValue(Object holder)
{
if (holder == null)
- throw new IllegalArgumentException(BundleUtils.getMessage(bundle, "ILLEGAL_NULL_PARAMETER"));
+ throw MESSAGES.illegalNullArgument("holder");
if (!javax.xml.rpc.holders.Holder.class.isInstance(holder))
- throw new IllegalArgumentException(BundleUtils.getMessage(bundle, "IS_NOT_A_HOLDER", holder));
+ throw MESSAGES.notAHolder(holder);
try
{
@@ -224,7 +218,7 @@
}
catch (Exception e)
{
- throw new IllegalArgumentException(BundleUtils.getMessage(bundle, "CANNOT_ACCESS_PUBLIC_VALUE_FIELD", holder));
+ throw MESSAGES.cannotFindOrAccessPublicFieldValue(holder);
}
}
@@ -239,15 +233,15 @@
public static void setHolderValue(Object holder, Object value)
{
if (holder == null)
- throw new IllegalArgumentException(BundleUtils.getMessage(bundle, "HOLDER_INSTANCE_WAS_NULL"));
+ throw MESSAGES.illegalNullArgument("holder");
if (!javax.xml.rpc.holders.Holder.class.isInstance(holder))
- throw new IllegalArgumentException(BundleUtils.getMessage(bundle, "IS_NOT_A_HOLDER", holder));
+ throw MESSAGES.notAHolder(holder);
Class valueType = getValueType(holder.getClass());
if (value != null && JavaUtils.isAssignableFrom(valueType, value.getClass()) == false)
- throw new IllegalArgumentException(BundleUtils.getMessage(bundle, "HOLDER_VALUE_NOT_ASSIGNABLE", new Object[]{ holder.getClass().getName() , value}));
+ throw MESSAGES.holderValueNotAssignable(holder.getClass().getName(), value);
if (valueType.isArray())
value = JavaUtils.syncArray(value, valueType);
@@ -264,7 +258,7 @@
}
catch (Exception e)
{
- throw new IllegalArgumentException(BundleUtils.getMessage(bundle, "CANNOT_ACCESS_PUBLIC_VALUE_FIELD", holder));
+ throw MESSAGES.cannotFindOrAccessPublicFieldValue(holder);
}
}
@@ -278,7 +272,7 @@
public static Object createHolderInstance(Object value, Class<?> holderType)
{
if (! isHolderType(holderType))
- throw new IllegalArgumentException(BundleUtils.getMessage(bundle, "NOT_A_HOLDER_TYPE", holderType.getName()));
+ throw MESSAGES.notAHolder(holderType);
Object holder;
@@ -292,7 +286,7 @@
}
catch (Exception e)
{
- throw new IllegalArgumentException(BundleUtils.getMessage(bundle, "CANNOT_INSTANCIATE_HOLDER", holderType));
+ throw new IllegalArgumentException(e);
}
setHolderValue(holder, value);
Deleted: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/utils/Message.properties
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/utils/Message.properties 2012-10-11 14:38:55 UTC (rev 16859)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/utils/Message.properties 2012-10-11 16:19:51 UTC (rev 16860)
@@ -1,19 +0,0 @@
-NO_BYTEARRAYCONVERTER_CLASS=No ByteArrayConverter for class: {0}
-NO_BYTEARRAYCONVERTER_CONTENT_TYPE=No ByteArrayConverter for content type: {0}
-FAILED_TO_CONVERT=Failed to convert {0}
-UNABLE_TO_CONVERT=Unable to convert {0}
-FAILED_TO_CONVERT_STRING=Failed to convert java.lang.String
-FAILED_TO_CONVERT_BYTE=Failed to convert byte[]
-ILLEGAL_NULL_PARAMETER=Illegal null parameter
-ALREADY_A_HOLDER=Is already a holder: {0}
-CANNOT_GET_HOLDER_TYPE=Cannot get holder type for: {0}
-IS_NOT_A_HOLDER=Is not a holder: {0}
-CANNOT_FIND_PUBLIC_VALUE_FIELD=Cannot find public value field: {0}
-ILLEGAL_NULL_PARAMETER=Illegal null parameter
-IS_NOT_A_HOLDER=Is not a holder: {0}
-CANNOT_ACCESS_PUBLIC_VALUE_FIELD=Cannot access public value field: {0}
-HOLDER_INSTANCE_WAS_NULL=Holder instance was null
-IS_NOT_A_HOLDER=Is not a holder: {0}
-HOLDER_VALUE_NOT_ASSIGNABLE=Holder [{0}] value not assignable: {1}
-NOT_A_HOLDER_TYPE=Not a holder type:{0}
-CANNOT_INSTANCIATE_HOLDER=Cannot instanciate holder: {0}
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/utils/MimeUtils.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/utils/MimeUtils.java 2012-10-11 14:38:55 UTC (rev 16859)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/utils/MimeUtils.java 2012-10-11 16:19:51 UTC (rev 16860)
@@ -21,6 +21,8 @@
*/
package org.jboss.ws.core.utils;
+import static org.jboss.ws.NativeMessages.MESSAGES;
+
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@@ -28,7 +30,6 @@
import java.io.OutputStream;
import java.util.HashMap;
import java.util.Map;
-import java.util.ResourceBundle;
import java.util.Set;
import javax.imageio.ImageIO;
@@ -42,8 +43,6 @@
import javax.xml.namespace.QName;
import javax.xml.transform.stream.StreamSource;
-import org.jboss.ws.WSException;
-import org.jboss.ws.api.util.BundleUtils;
import org.jboss.ws.common.Constants;
import org.jboss.ws.common.IOUtils;
import org.jboss.ws.common.JavaUtils;
@@ -55,11 +54,9 @@
*/
public class MimeUtils
{
- private static final ResourceBundle bundle = BundleUtils.getBundle(MimeUtils.class);
+ private static Map<String, Class<?>> mime2class = new HashMap<String, Class<?>>();
+ private static Map<Class<?>, String> class2mime = new HashMap<Class<?>, String>();
- private static Map<String, Class> mime2class = new HashMap<String, Class>();
- private static Map<Class, String> class2mime = new HashMap<Class, String>();
-
static {
mime2class.put("text/plain", java.lang.String.class);
mime2class.put("image/jpeg", java.awt.Image.class);
@@ -127,7 +124,7 @@
* @param mimeTypes the set of mime types to search
* @return true if there is a match, false if not
*/
- public static boolean isMemberOf(String mimeType, Set mimeTypes)
+ public static boolean isMemberOf(String mimeType, Set<?> mimeTypes)
{
if (mimeTypes.contains(mimeType))
return true;
@@ -149,8 +146,8 @@
* Resolve the class for a mype type.
* Defaults to <code>DataHandler</code> if no mapping could be found.
*/
- public static Class resolveClass(String mimeType) {
- Class cl = mime2class.get(mimeType);
+ public static Class<?> resolveClass(String mimeType) {
+ Class<?> cl = mime2class.get(mimeType);
if(null==cl)
cl = javax.activation.DataHandler.class;
return cl;
@@ -168,9 +165,9 @@
return mimeType;
}
- public static String resolveMimeType(Class clazz) {
+ public static String resolveMimeType(Class<?> clazz) {
String mimeType = "application/octet-stream";
- for(Class cl : class2mime.keySet())
+ for(Class<?> cl : class2mime.keySet())
{
if(JavaUtils.isAssignableFrom(cl, clazz))
mimeType = class2mime.get(cl);
@@ -178,7 +175,7 @@
return mimeType;
}
- public static ByteArrayConverter getConverterForJavaType(Class targetClazz)
+ public static ByteArrayConverter getConverterForJavaType(Class<?> targetClazz)
{
ByteArrayConverter converter = null;
if(JavaUtils.isAssignableFrom(java.awt.Image.class, targetClazz))
@@ -193,7 +190,7 @@
converter = new RealByteArrayConverter();
if(null == converter)
- throw new WSException(BundleUtils.getMessage(bundle, "NO_BYTEARRAYCONVERTER_CLASS", targetClazz.getName()));
+ throw MESSAGES.noByteArrayConverterFor(targetClazz.getName());
return converter;
}
@@ -215,7 +212,7 @@
}
if(null == converter)
- throw new WSException(BundleUtils.getMessage(bundle, "NO_BYTEARRAYCONVERTER_CONTENT_TYPE", contentType));
+ throw MESSAGES.noByteArrayConverterFor(contentType);
return converter;
}
@@ -252,12 +249,12 @@
}
catch (IOException e)
{
- throw new WSException(BundleUtils.getMessage(bundle, "FAILED_TO_CONVERT", obj.getClass()));
+ throw MESSAGES.failedToConvert(obj.getClass());
}
}
else
{
- throw new WSException(BundleUtils.getMessage(bundle, "UNABLE_TO_CONVERT", obj.getClass()));
+ throw MESSAGES.failedToConvert(obj.getClass());
}
}
@@ -280,12 +277,12 @@
}
catch (IOException e)
{
- throw new WSException(BundleUtils.getMessage(bundle, "FAILED_TO_CONVERT", obj.getClass()));
+ throw MESSAGES.failedToConvert(obj.getClass());
}
}
else
{
- throw new WSException(BundleUtils.getMessage(bundle, "UNABLE_TO_CONVERT", obj.getClass()));
+ throw MESSAGES.failedToConvert(obj.getClass());
}
}
}
@@ -305,7 +302,7 @@
}
catch (IOException e)
{
- throw new WSException(BundleUtils.getMessage(bundle, "FAILED_TO_CONVERT_STRING"));
+ throw MESSAGES.failedToConvert("java.lang.String");
}
return converted;
@@ -321,12 +318,12 @@
}
catch (IOException e)
{
- throw new WSException(BundleUtils.getMessage(bundle, "FAILED_TO_CONVERT", obj.getClass()));
+ throw MESSAGES.failedToConvert(obj.getClass());
}
}
else
{
- throw new WSException(BundleUtils.getMessage(bundle, "UNABLE_TO_CONVERT", obj.getClass()));
+ throw MESSAGES.failedToConvert(obj.getClass());
}
}
}
@@ -347,7 +344,7 @@
}
catch (IOException e)
{
- throw new WSException(BundleUtils.getMessage(bundle, "FAILED_TO_CONVERT_BYTE"));
+ throw MESSAGES.failedToConvert("byte[]");
}
return converted;
@@ -364,12 +361,12 @@
}
catch (IOException e)
{
- throw new WSException(BundleUtils.getMessage(bundle, "FAILED_TO_CONVERT", obj.getClass()));
+ throw MESSAGES.failedToConvert(obj.getClass());
}
}
else
{
- throw new WSException(BundleUtils.getMessage(bundle, "UNABLE_TO_CONVERT", obj.getClass()));
+ throw MESSAGES.failedToConvert(obj.getClass());
}
}
}
@@ -389,7 +386,7 @@
}
catch (IOException e)
{
- throw new WSException(BundleUtils.getMessage(bundle, "FAILED_TO_CONVERT", obj.getClass()));
+ throw MESSAGES.failedToConvert(obj.getClass());
}
}
}
More information about the jbossws-commits
mailing list