ws-axis-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sc...@apache.org
Subject svn commit: r683622 - in /webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws: marshaller/impl/alt/Attachment.java message/impl/MessageImpl.java
Date Thu, 07 Aug 2008 14:27:47 GMT
Author: scheu
Date: Thu Aug  7 07:27:46 2008
New Revision: 683622

URL: http://svn.apache.org/viewvc?rev=683622&view=rev
Log:
AXIS2-3963
Contributor:Samuel Isokpunwu and Bruce Tiffany
Prevent NPE if null data handlers are used.

Modified:
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/Attachment.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/MessageImpl.java

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/Attachment.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/Attachment.java?rev=683622&r1=683621&r2=683622&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/Attachment.java
(original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/Attachment.java
Thu Aug  7 07:27:46 2008
@@ -95,7 +95,15 @@
      */
     public DataHandler getDataHandler() {
         if (dh == null) {
-            dh = createDataHandler(sigValue, sigClass, aDesc.getMimeTypes(), getContentID());
+        	//if null DH was specified explicitly, return it, don't create something else.
+            if (sigValue == null) {
+                // Create a contentID and null DataHandler
+                getContentID(); // Force setting of content id
+                dh = (DataHandler) null;
+            } else {
+                // Normal case: create a DataHandler from the sigValue object
+                dh = createDataHandler(sigValue, sigClass, aDesc.getMimeTypes(), getContentID());
+            }
         }
         return dh;
     }
@@ -123,6 +131,11 @@
         DataHandler dh = null;
         if (cls.isAssignableFrom(DataHandler.class)) {
             dh = (DataHandler) value;
+            if(dh == null)  
+            {
+                return dh; //return if DataHandler is null
+            }
+
             try {
                 Object content = dh.getContent();
                 // If the content is a Source, convert to a String due to 

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/MessageImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/MessageImpl.java?rev=683622&r1=683621&r2=683622&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/MessageImpl.java
(original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/MessageImpl.java
Thu Aug  7 07:27:46 2008
@@ -443,6 +443,10 @@
      * @see org.apache.axis2.jaxws.message.Message#getDataHandler(java.lang.String)
      */
     public DataHandler getDataHandler(String cid) {
+        // if null DH was specified explicitly, just return
+        if(cid == null) {
+            return (DataHandler) null;
+        }
         String bcid = getBlobCID(cid);
         return attachments.getDataHandler(bcid);
     }



Mime
View raw message