axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sc...@apache.org
Subject svn commit: r583477 - in /webservices/axis2/trunk/java/modules: jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/ jaxws/src/org/apache/axis2/jaxws/message/impl/ jaxws/src/org/apache/axis2/jaxws/server/dispatcher/ kernel/src/org/apache/axis2/co...
Date Wed, 10 Oct 2007 13:59:47 GMT
Author: scheu
Date: Wed Oct 10 06:59:46 2007
New Revision: 583477

URL: http://svn.apache.org/viewvc?rev=583477&view=rev
Log:
AXIS2-3260
JavaDispatcher/JavaProvider fixes.
Extra trace in other classes.

Modified:
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/SourceBlockImpl.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/BlockImpl.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/JavaDispatcher.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/ProviderDispatcher.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/externalize/DebugObjectInput.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/externalize/DebugObjectOutputStream.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/externalize/SafeObjectInputStream.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/externalize/SafeObjectOutputStream.java

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/SourceBlockImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/SourceBlockImpl.java?rev=583477&r1=583476&r2=583477&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/SourceBlockImpl.java
(original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/SourceBlockImpl.java
Wed Oct 10 06:59:46 2007
@@ -78,6 +78,10 @@
             // Dynamically discover if StAXSource is available
             staxSource = forName("javax.xml.transform.stax.StAXSource");
         } catch (Exception e) {
+            if (log.isDebugEnabled()) {
+                log.debug("StAXSource is not present in the JDK.  " +
+                                "This is acceptable.  Processing continues");
+            }
         }
         try {
             // Woodstox does not work with StAXSource
@@ -106,6 +110,9 @@
                 (busObject.getClass().equals(staxSource)) ||
                 busObject instanceof JAXBSource) {
             // Okay, these are supported Source objects
+            if (log.isDebugEnabled()) {
+                log.debug("data object is a " + busObject.getClass().getName());
+            }
         } else {
             throw ExceptionFactory.makeWebServiceException(
                     Messages.getMessage("SourceNotSupported", busObject.getClass().getName()));
@@ -199,9 +206,19 @@
 
     /** Creates an XMLStreamReader from a Source using a slow but proven algorithm. */
     private XMLStreamReader _slow_getReaderFromSource(Source src) throws XMLStreamException
{
+        if (log.isDebugEnabled()) {
+            log.debug("Start _slow_getReaderFromSource");
+        }
         byte[] bytes = (byte[]) ConvertUtils.convert(src, byte[].class);
+        if (log.isDebugEnabled()) {
+            log.debug("Successfully converted to ByteArray");
+        }
         ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
-        return StAXUtils.createXMLStreamReader(bais);
+        XMLStreamReader reader = StAXUtils.createXMLStreamReader(bais);
+        if (log.isDebugEnabled()) {
+            log.debug("End _slow_getReaderFromSource =" + reader);
+        }
+        return reader;
     }
 
     @Override
@@ -209,8 +226,17 @@
             throws XMLStreamException, WebServiceException {
         // There is no fast way to output the Source to a writer, so get the reader
         // and pass use the default reader->writer.
+        if (log.isDebugEnabled()) {
+            log.debug("Start _outputFromBO");
+        }
         XMLStreamReader reader = _getReaderFromBO(busObject, busContext);
+        if (log.isDebugEnabled()) {
+            log.debug("Obtained reader=" + reader);
+        }
         _outputFromReader(reader, writer);
+        if (log.isDebugEnabled()) {
+            log.debug("End _outputReaderFromBO");
+        }
         // REVIEW Should we call close() on the Source ?
     }
 
@@ -339,11 +365,19 @@
 
 
     public byte[] getXMLBytes(String encoding) throws UnsupportedEncodingException {
+        if (log.isDebugEnabled()) {
+            log.debug("Start getXMLBytes");
+        }
+        byte[] bytes = null;
         try {
-            return (byte[]) 
+            bytes = (byte[]) 
                 ConvertUtils.convert(getBusinessObject(false), byte[].class);
         } catch (XMLStreamException e) {
             throw ExceptionFactory.makeWebServiceException(e);
         }
+        if (log.isDebugEnabled()) {
+            log.debug("End getXMLBytes");
+        }
+        return bytes;
     }
 }

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/BlockImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/BlockImpl.java?rev=583477&r1=583476&r2=583477&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/BlockImpl.java
(original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/BlockImpl.java
Wed Oct 10 06:59:46 2007
@@ -322,6 +322,9 @@
 
     public void outputTo(XMLStreamWriter writer, boolean consume)
             throws XMLStreamException, WebServiceException {
+        if (log.isDebugEnabled()) {
+            log.debug("Start outputTo");
+        }
         if (consumed) {
             // In some scenarios, the message is written out after the service instance is
invoked.
             // In these situations, it is preferable to simply ignore this block.
@@ -333,15 +336,27 @@
         }
         if (omElement != null) {
             if (consume) {
+                if (log.isDebugEnabled()) {
+                    log.debug("Write using OMElement.serializeAndConsume");
+                }
                 omElement.serializeAndConsume(writer);
             } else {
+                if (log.isDebugEnabled()) {
+                    log.debug("Write Using OMElement.serialize");
+                }
                 omElement.serialize(writer);
             }
         } else if (busObject != null) {
+            if (log.isDebugEnabled()) {
+                log.debug("Write business object");
+            }
             busObject = _getBOFromBO(busObject, busContext, consume);
             _outputFromBO(busObject, busContext, writer);
         }
         setConsumed(consume);
+        if (log.isDebugEnabled()) {
+            log.debug("End outputTo");
+        }
         return;
     }
 

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/JavaDispatcher.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/JavaDispatcher.java?rev=583477&r1=583476&r2=583477&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/JavaDispatcher.java
(original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/JavaDispatcher.java
Wed Oct 10 06:59:46 2007
@@ -99,79 +99,86 @@
         }
         
         public Object call() throws Exception {
-            if (log.isDebugEnabled()) {
-                log.debug("Invoking target endpoint via the async worker.");
-            }
-            
-            // Set the proper class loader so that we can properly marshall the
-            // outbound response.
-            ClassLoader currentLoader = Thread.currentThread().getContextClassLoader();
-            if (classLoader != null) {
-                Thread.currentThread().setContextClassLoader(classLoader);
-                if (log.isDebugEnabled()) {
-                    log.debug("Context ClassLoader set to:" + classLoader);
-                }
-            }
-            
-            // We have the method that is going to be invoked and the parameter data to invoke
it 
-            // with, so just invoke the operation.
-            Object output = null;
-            boolean faultThrown = false;
-            Throwable fault = null;
             try {
-                output = invokeTargetOperation(method, params);
-            } 
-            catch (Exception e) {
-                fault = ClassUtils.getRootCause(e);
-                faultThrown = true;
-            }
-            
-            // If this is a one way invocation, we are done and just need to return.
-            if (eic.isOneWay()) {
                 if (log.isDebugEnabled()) {
-                    log.debug("Invocation pattern was one way, work complete.");
-                    return null;
+                    log.debug("Invoking target endpoint via the async worker.");
                 }
-            }
-            
-            // Create the response MessageContext
-            MessageContext request = eic.getRequestMessageContext();
-            MessageContext response = null;
-            if (faultThrown) {
-                // If a fault was thrown, we need to create a slightly different
-                // MessageContext, than in the response path.
-                response = createFaultResponse(request, fault);
-            } else {
-                if (log.isDebugEnabled()) {
-                    log.debug("Async invocation of the endpoint was successful.  Creating
response message.");
+                
+                // Set the proper class loader so that we can properly marshall the
+                // outbound response.
+                ClassLoader currentLoader = Thread.currentThread().getContextClassLoader();
+                if (classLoader != null) {
+                    Thread.currentThread().setContextClassLoader(classLoader);
+                    if (log.isDebugEnabled()) {
+                        log.debug("Context ClassLoader set to:" + classLoader);
+                    }
+                }
+                
+                // We have the method that is going to be invoked and the parameter data
to invoke it 
+                // with, so just invoke the operation.
+                Object output = null;
+                boolean faultThrown = false;
+                Throwable fault = null;
+                try {
+                    output = invokeTargetOperation(method, params);
+                } 
+                catch (Exception e) {
+                    fault = ClassUtils.getRootCause(e);
+                    faultThrown = true;
+                }
+                
+                // If this is a one way invocation, we are done and just need to return.
+                if (eic.isOneWay()) {
+                    if (log.isDebugEnabled()) {
+                        log.debug("Invocation pattern was one way, work complete.");
+                        return null;
+                    }
+                }
+                
+                // Create the response MessageContext
+                MessageContext request = eic.getRequestMessageContext();
+                MessageContext response = null;
+                if (faultThrown) {
+                    // If a fault was thrown, we need to create a slightly different
+                    // MessageContext, than in the response path.
+                    response = createFaultResponse(request, fault);
+                } else {
+                    if (log.isDebugEnabled()) {
+                        log.debug("Async invocation of the endpoint was successful.  Creating
response message.");
+                    }
+                    response = createResponse(request, params, output);
                 }
-                response = createResponse(request, params, output);
-            }
 
-            EndpointInvocationContext eic = null;
-            if (request.getInvocationContext() != null) {
-                eic = (EndpointInvocationContext) request.getInvocationContext();
-                eic.setResponseMessageContext(response);                
-            }
-            
-            EndpointCallback callback = eic.getCallback();
-            boolean handleFault = response.getMessage().isFault();
-            if (!handleFault) {
-                if (log.isDebugEnabled()) {
-                    log.debug("No fault detected in response message, sending back application
response.");
+                EndpointInvocationContext eic = null;
+                if (request.getInvocationContext() != null) {
+                    eic = (EndpointInvocationContext) request.getInvocationContext();
+                    eic.setResponseMessageContext(response);                
                 }
-                callback.handleResponse(eic);
-            }
-            else {
-                if (log.isDebugEnabled()) {
-                    log.debug("A fault was detected.  Sending back a fault response.");
+                
+                EndpointCallback callback = eic.getCallback();
+                boolean handleFault = response.getMessage().isFault();
+                if (!handleFault) {
+                    if (log.isDebugEnabled()) {
+                        log.debug("No fault detected in response message, sending back application
response.");
+                    }
+                    callback.handleResponse(eic);
                 }
-                callback.handleFaultResponse(eic);
+                else {
+                    if (log.isDebugEnabled()) {
+                        log.debug("A fault was detected.  Sending back a fault response.");
+                    }
+                    callback.handleFaultResponse(eic);
+                }
+                
+                // Set the thread's ClassLoader back to what it originally was.
+                Thread.currentThread().setContextClassLoader(currentLoader);
+                
+            } catch (Throwable e) {
+                // Exceptions are swallowed, there is no reason to rethrow them
+                log.error("AN UNEXPECTED ERROR OCCURRED IN THE ASYNC WORKER THREAD");
+                log.error("Exception is:" + e);
             }
-            
-            // Set the thread's ClassLoader back to what it originally was.
-            Thread.currentThread().setContextClassLoader(currentLoader);
-            
+
             return null;
         }
     }

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/ProviderDispatcher.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/ProviderDispatcher.java?rev=583477&r1=583476&r2=583477&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/ProviderDispatcher.java
(original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/ProviderDispatcher.java
Wed Oct 10 06:59:46 2007
@@ -71,14 +71,10 @@
 
     private static Log log = LogFactory.getLog(ProviderDispatcher.class);
 
-    private BlockFactory blockFactory = null;
-    private Class providerType = null;
+    private BlockFactory _blockFactory = null;  // Cache the block factory
+    private Class _providerType = null;        // Cache the provider type
     private Provider providerInstance = null;
-    private Service.Mode providerServiceMode = null;
     private Message message = null;
-    private Protocol messageProtocol;
-
-    private EndpointDescription endpointDesc;
 
     /**
      * Constructor
@@ -104,6 +100,7 @@
         Object param = createRequestParameters(request);
 
         if (log.isDebugEnabled()) {
+            Class providerType = getProviderType();
             final Object input = providerType.cast(param);
             log.debug("Invoking Provider<" + providerType.getName() + ">");
             if (input != null) {
@@ -125,9 +122,6 @@
             fault = ClassUtils.getRootCause(e);
             faultThrown = true;
         }
-
-        // TODO (NLG): Need to find a better way to sync this across both Dispatchers.
-        endpointDesc = request.getEndpointDescription();
         
         // Create the response MessageContext
         MessageContext responseMsgCtx = null;
@@ -153,6 +147,7 @@
         Object param = createRequestParameters(request);
 
         if (log.isDebugEnabled()) {
+            Class providerType = getProviderType();
             final Object input = providerType.cast(param);
             log.debug("Invoking Provider<" + providerType.getName() + ">");
             if (input != null) {
@@ -190,6 +185,7 @@
         Object param = createRequestParameters(request);
 
         if (log.isDebugEnabled()) {
+            Class providerType = getProviderType();
             final Object input = providerType.cast(param);
             log.debug("Invoking Provider<" + providerType.getName() + ">");
             if (input != null) {
@@ -219,7 +215,7 @@
     public Object createRequestParameters(MessageContext request) {
         // First we need to know what kind of Provider instance we're going
         // to be invoking against
-        providerType = getProviderType();
+        Class providerType = getProviderType();
 
         // REVIEW: This assumes there is only one endpoint description on the service.  Is
that always the case?
         EndpointDescription endpointDesc = request.getEndpointDescription();
@@ -240,12 +236,12 @@
             }
 
             // Save off the protocol info so we can use it when creating the response message.
-            messageProtocol = message.getProtocol();
+            Protocol messageProtocol = message.getProtocol();
             // Determine what type blocks we want to create (String, Source, etc) based on
Provider Type
             BlockFactory factory = createBlockFactory(providerType);
 
 
-            providerServiceMode = endpointDesc.getServiceMode();
+            Service.Mode providerServiceMode = endpointDesc.getServiceMode();
 
             if (providerServiceMode != null && providerServiceMode == Service.Mode.MESSAGE)
{
                 if (providerType.equals(SOAPMessage.class)) {
@@ -289,33 +285,64 @@
     }
     
     public MessageContext createResponse(MessageContext request, Object[] input, Object output)
{
+        if (log.isDebugEnabled()) {
+            log.debug("Start createResponse");
+        }
         Message m;
+        EndpointDescription endpointDesc = null;
         try {
-            m = createMessageFromValue(output);
-        } catch (Exception e) {
-            throw ExceptionFactory.makeWebServiceException(e);
+            endpointDesc = request.getEndpointDescription();
+            Service.Mode mode = endpointDesc.getServiceMode();
+            m = createMessageFromValue(output, request.getMessage().getProtocol(), mode);
+        } catch (Throwable t) {
+            if (log.isDebugEnabled()) {
+                log.debug("Throwable caught");
+                log.debug("Throwable=" + t);
+            }
+            throw ExceptionFactory.makeWebServiceException(t);
         }
 
-        // Enable MTOM if indicated by the binding
-        String bindingType = endpointDesc.getBindingType();
-        if (bindingType != null) {
-            if (bindingType.equals(SOAPBinding.SOAP11HTTP_MTOM_BINDING)
-                    || bindingType.equals(SOAPBinding.SOAP12HTTP_MTOM_BINDING)) {
-                m.setMTOMEnabled(true);
-            }
+        if (log.isDebugEnabled()) {
+            log.debug("Response message is created.");
         }
+        
+        MessageContext response = null;
+        try {
+            // Enable MTOM if indicated by the binding
+            String bindingType = endpointDesc.getBindingType();
+            if (bindingType != null) {
+                if (bindingType.equals(SOAPBinding.SOAP11HTTP_MTOM_BINDING)
+                        || bindingType.equals(SOAPBinding.SOAP12HTTP_MTOM_BINDING)) {
+                    m.setMTOMEnabled(true);
+                }
+            }
 
-        MessageContext response = MessageContextUtils.createResponseMessageContext(request);
-        response.setMessage(m);
+            response = MessageContextUtils.createResponseMessageContext(request);
+            response.setMessage(m);
+        } catch (RuntimeException e) {
+            if (log.isDebugEnabled()) {
+                log.debug("Throwable caught creating Response MessageContext");
+                log.debug("Throwable=" + e);
+            }
+        } finally {
+            if (log.isDebugEnabled()) {
+                log.debug("End createResponse");
+            }
+        }
         
         return response;
     }
     
     public MessageContext createFaultResponse(MessageContext request, Throwable fault) {
+        if (log.isDebugEnabled()) {
+            log.debug("Create XMLFault for createFaultResponse");
+        }
         Message m;
         try {
+            EndpointDescription endpointDesc = request.getEndpointDescription();
+            Service.Mode mode = endpointDesc.getServiceMode();
             XMLFault xmlFault = MethodMarshallerUtils.createXMLFaultFromSystemException(fault);
-            m = createMessageFromValue(xmlFault);
+            m = createMessageFromValue(xmlFault, request.getMessage().getProtocol(), mode);
         } catch (Exception e) {
             throw ExceptionFactory.makeWebServiceException(e);
         }
@@ -369,37 +396,52 @@
     /*
     * Create a Message object out of the value object that was returned.
     */
-    private Message createMessageFromValue(Object value) throws Exception {
+    private Message createMessageFromValue(Object value, Protocol protocol, 
+                                           Service.Mode mode) throws Exception {
         MessageFactory msgFactory =
                 (MessageFactory)FactoryRegistry.getFactory(MessageFactory.class);
         Message message = null;
 
         if (value != null) {
+            Class providerType = getProviderType();
             BlockFactory factory = createBlockFactory(providerType);
 
             if (value instanceof XMLFault) {
-                message = msgFactory.create(messageProtocol);
+                if (log.isDebugEnabled()) {
+                    log.debug("Creating message from XMLFault");
+                }
+                message = msgFactory.create(protocol);
                 message.setXMLFault((XMLFault)value);
-            } else if (providerServiceMode != null && providerServiceMode == Service.Mode.MESSAGE)
{
+            } else if (mode != null && mode == Service.Mode.MESSAGE) {
                 // For MESSAGE mode, work with the entire message, Headers and Body
                 // This is based on logic in org.apache.axis2.jaxws.client.XMLDispatch.createMessageFromBundle()
                 if (value instanceof SOAPMessage) {
+                    if (log.isDebugEnabled()) {
+                        log.debug("Creating message from SOAPMessage");
+                    }
                     message = msgFactory.createFrom((SOAPMessage)value);
                 } else {
+                    if (log.isDebugEnabled()) {
+                        log.debug("Creating message using " + factory);
+                    }
                     Block block = factory.createFrom(value, null, null);
-                    message = msgFactory.createFrom(block, null, messageProtocol);
+                    message = msgFactory.createFrom(block, null, protocol);
                 }
             } else {
                 // PAYLOAD mode deals only with the body of the message.
+                if (log.isDebugEnabled()) {
+                    log.debug("Creating message (payload) using " + factory);
+                }
                 Block block = factory.createFrom(value, null, null);
-                message = msgFactory.create(messageProtocol);
+                message = msgFactory.create(protocol);
                 message.setBodyBlock(block);
             }
         }
 
-        if (message == null)
+        if (message == null) {
             // If we didn't create a message above (because there was no value), create one
here
-            message = msgFactory.create(messageProtocol);
+            message = msgFactory.create(protocol);
+        }
 
 
         return message;
@@ -441,6 +483,9 @@
      */
     private Class<?> getProviderType() {
 
+        if (_providerType != null) {
+            return _providerType;
+        }
         Class providerType = null;
 
         Type[] giTypes = serviceImplClass.getGenericInterfaces();
@@ -462,6 +507,7 @@
                 providerType = (Class)paramType.getActualTypeArguments()[0];
             }
         }
+        _providerType = providerType;
         return providerType;
     }
 
@@ -496,24 +542,25 @@
     * Given a target class type for a payload, load the appropriate BlockFactory.
     */
     private BlockFactory createBlockFactory(Class type) {
-        if (blockFactory != null)
-            return blockFactory;
+        if (_blockFactory != null) {
+            return _blockFactory;
+        }
 
         if (type.equals(String.class)) {
-            blockFactory = (XMLStringBlockFactory)FactoryRegistry.getFactory(
+            _blockFactory = (XMLStringBlockFactory)FactoryRegistry.getFactory(
                     XMLStringBlockFactory.class);
         } else if (type.equals(Source.class)) {
-            blockFactory = (SourceBlockFactory)FactoryRegistry.getFactory(
+            _blockFactory = (SourceBlockFactory)FactoryRegistry.getFactory(
                     SourceBlockFactory.class);
         } else if (type.equals(SOAPMessage.class)) {
-            blockFactory = (SOAPEnvelopeBlockFactory)FactoryRegistry.getFactory(
+            _blockFactory = (SOAPEnvelopeBlockFactory)FactoryRegistry.getFactory(
                     SOAPEnvelopeBlockFactory.class);
         } else {
-            ExceptionFactory.makeWebServiceException("Unable to find BlockFactory " +
+            throw ExceptionFactory.makeWebServiceException("Unable to find BlockFactory "
+
                     "for type: " + type.getClass().getName());
         }
 
-        return blockFactory;
+        return _blockFactory;
     }
     
     protected Method getJavaMethod() {

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/externalize/DebugObjectInput.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/externalize/DebugObjectInput.java?rev=583477&r1=583476&r2=583477&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/externalize/DebugObjectInput.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/externalize/DebugObjectInput.java
Wed Oct 10 06:59:46 2007
@@ -143,7 +143,7 @@
         trace("start readObject()");
         Object value = oi.readObject();
         
-        trace("end readObject()="+ value);
+        trace("end readObject()="+ valueName(value));
         return value;
     }
 
@@ -195,4 +195,13 @@
         }
     }
     
+    private String valueName(Object obj) {
+        if (obj == null) {
+            return "null";
+        } else if (obj instanceof String) {
+            return (String) obj;
+        } else {
+            return "Object of class = " + obj.getClass().getName();
+        }
+    }
 }

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/externalize/DebugObjectOutputStream.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/externalize/DebugObjectOutputStream.java?rev=583477&r1=583476&r2=583477&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/externalize/DebugObjectOutputStream.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/externalize/DebugObjectOutputStream.java
Wed Oct 10 06:59:46 2007
@@ -131,7 +131,7 @@
     }
 
     public void writeObject(Object obj) throws IOException {
-        trace ("start writeObject(v) v=" + obj);
+        trace ("start writeObject(v) v=" + valueName(obj));
         out.writeObject(obj);
         trace ("end writeObject(v)");
     }
@@ -151,6 +151,16 @@
     public void trace(String str) {
         if (isDebug) {
             log.debug(str);
+        }
+    }
+    
+    private String valueName(Object obj) {
+        if (obj == null) {
+            return "null";
+        } else if (obj instanceof String) {
+            return (String) obj;
+        } else {
+            return "Object of class = " + obj.getClass().getName();
         }
     }
 }

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/externalize/SafeObjectInputStream.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/externalize/SafeObjectInputStream.java?rev=583477&r1=583476&r2=583477&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/externalize/SafeObjectInputStream.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/externalize/SafeObjectInputStream.java
Wed Oct 10 06:59:46 2007
@@ -200,7 +200,7 @@
                 }
                 // Put the key and value in the map
                 if (isDebug) {
-                    log.debug("Read key=" + key + " value="+value);
+                    log.debug("Read key=" + valueName(key) + " value="+valueName(value));
                 }
                 map.put(key, value);
             } catch (ClassNotFoundException e) {
@@ -273,9 +273,9 @@
                     tempOIS.close();
                     bais.close();
                 }
-                // Put the key and value in the map
+                // Put the key and value in the list
                 if (isDebug) {
-                    log.debug("Read value="+value);
+                    log.debug("Read value="+valueName(value));
                 }
                 list.add(value);
             } catch (IOException e) {
@@ -341,10 +341,20 @@
         }
         
         if (isDebug) {
-            log.debug("Read object=" + obj);
+            log.debug("Read object=" + valueName(obj));
         }
         return obj;   
         
+    }
+    
+    private String valueName(Object obj) {
+        if (obj == null) {
+            return "null";
+        } else if (obj instanceof String) {
+            return (String) obj;
+        } else {
+            return "Object of class = " + obj.getClass().getName();
+        }
     }
     
     /**

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/externalize/SafeObjectOutputStream.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/externalize/SafeObjectOutputStream.java?rev=583477&r1=583476&r2=583477&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/externalize/SafeObjectOutputStream.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/externalize/SafeObjectOutputStream.java
Wed Oct 10 06:59:46 2007
@@ -332,7 +332,7 @@
                        boolean isSafe) throws IOException {
         
         if (isDebug) {
-            log.debug("Writing object:" + obj);
+            log.debug("Writing object:" + valueName(obj));
         }
         
         // Shortcut for null objects
@@ -431,7 +431,8 @@
                        boolean isSafe2) throws IOException {
         
         if (isDebug) {
-            log.debug("Writing key=" + obj1 + " value="+obj2);
+            log.debug("Writing key=" + valueName(obj1) + 
+                      " value="+valueName(obj2));
         }
         // Shortcut for non-serializable objects
         if ((!isSafe1 && !isSerializable(obj1)) ||
@@ -505,7 +506,7 @@
                        boolean isSafe) throws IOException {
         
         if (isDebug) {
-            log.debug("Writing obj=" + obj);
+            log.debug("Writing obj=" + valueName(obj));
         }
         // Shortcut for non-serializable objects
         if (!isSafe && !isSerializable(obj)) {
@@ -692,6 +693,15 @@
         }
     }
     
+    private String valueName(Object obj) {
+        if (obj == null) {
+            return "null";
+        } else if (obj instanceof String) {
+            return (String) obj;
+        } else {
+            return "Object of class = " + obj.getClass().getName();
+        }
+    }
     /**
      * MyBAOS is a ByteArrayOutputStream with a few additions.
      *



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message