rineholt    02/05/24 05:53:18

  Modified:    java/src/org/apache/axis/deployment/wsdd
                        WSDDDeployableItem.java
               java/src/org/apache/axis/encoding
                        SerializationContextImpl.java
               java/src/org/apache/axis/encoding/ser
                        JAFDataHandlerSerializer.java
               java/src/org/apache/axis/transport/http HTTPSender.java
  Log:
  WSDDDeployableItem.java capture exception specifics on handler init()s.
  HTTPSender.java Close the outputsocket when we don't need it anymore.
  SerializationContextImpl.java  don't copy attributes if there are none.
    While this should be ok, it seems to giving hangs in "some" environments
    within the SAX API.  BUG in SAX?
  
  Revision  Changes    Path
  1.28      +25 -2     
xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDDeployableItem.java
  
  Index: WSDDDeployableItem.java
  ===================================================================
  RCS file: 
/home/cvs/xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDDeployableItem.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- WSDDDeployableItem.java   9 Apr 2002 15:41:29 -0000       1.27
  +++ WSDDDeployableItem.java   24 May 2002 12:53:17 -0000      1.28
  @@ -63,6 +63,8 @@
   import org.apache.axis.deployment.DeploymentException;
   import org.apache.axis.utils.LockableHashtable;
   import org.apache.axis.utils.XMLUtils;
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
   import org.w3c.dom.Document;
   import org.w3c.dom.Element;
   import org.w3c.dom.Node;
  @@ -91,6 +93,9 @@
                                                "per-request",
                                                "singleton" };
       
  +    protected static Log log =
  +        LogFactory.getLog(WSDDDeployableItem.class.getName());
  +
       /** Our parameters */
       LockableHashtable parameters;
   
  @@ -291,7 +296,7 @@
           throws ConfigurationException
       {
           if (scope == SCOPE_SINGLETON) {
  -            synchronized (this) {
  +             synchronized (this) {
                   if (singletonInstance == null)
                       singletonInstance = makeNewInstance(registry);
               }
  @@ -333,7 +338,17 @@
                   if ( qname != null )
                     h.setName(qname.getLocalPart()); 
                   h.setOptions(getParametersTable());
  -                h.init();
  +                try{
  +                  h.init();
  +                }catch(Exception e){
  +                    String msg=e +"\n"+stackToString(e);
  +                    log.debug(msg);
  +                    throw new ConfigurationException(e);
  +                }catch(Error e){
  +                    String msg=e +"\n"+stackToString(e);
  +                    log.debug(msg);
  +                    throw new ConfigurationException(msg);
  +                }
               }
           } else {
               h = registry.getHandler(getType());
  @@ -369,5 +384,13 @@
               return Class.forName(type.getLocalPart());
           }
           return null;
  +    }
  +
  +    protected static String stackToString(Throwable e){
  +      java.io.StringWriter sw= new java.io.StringWriter(1024); 
  +      java.io.PrintWriter pw= new java.io.PrintWriter(sw); 
  +      e.printStackTrace(pw);
  +      pw.close();
  +      return sw.toString();
       }
   }
  
  
  
  1.26      +3 -3      
xml-axis/java/src/org/apache/axis/encoding/SerializationContextImpl.java
  
  Index: SerializationContextImpl.java
  ===================================================================
  RCS file: 
/home/cvs/xml-axis/java/src/org/apache/axis/encoding/SerializationContextImpl.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- SerializationContextImpl.java     10 May 2002 13:17:18 -0000      1.25
  +++ SerializationContextImpl.java     24 May 2002 12:53:17 -0000      1.26
  @@ -551,7 +551,7 @@
               // passed with xsi:nil="true" to indicate that no object is present.
               if (sendNull) {
                   AttributesImpl attrs = new AttributesImpl();
  -                if (attributes != null)
  +                if (attributes != null && 0 < attributes.getLength())
                       attrs.setAttributes(attributes);
                   if (sendType)
                       attrs = (AttributesImpl) setTypeAttribute(attrs, xmlType);
  @@ -613,7 +613,7 @@
               }
   
               AttributesImpl attrs = new AttributesImpl();
  -            if (attributes != null)
  +            if (attributes != null && 0 < attributes.getLength())
                   attrs.setAttributes(attributes);
               attrs.addAttribute("", Constants.ATTR_HREF, "href",
                                  "CDATA", "#" + id);
  @@ -961,7 +961,7 @@
               return attributes;
   
           AttributesImpl attrs = new AttributesImpl();
  -        if (attributes != null)
  +        if (attributes != null && 0 < attributes.getLength() )
               attrs.setAttributes(attributes);
   
           String prefix = getPrefixForURI(Constants.URI_CURRENT_SCHEMA_XSI,
  
  
  
  1.5       +1 -1      
xml-axis/java/src/org/apache/axis/encoding/ser/JAFDataHandlerSerializer.java
  
  Index: JAFDataHandlerSerializer.java
  ===================================================================
  RCS file: 
/home/cvs/xml-axis/java/src/org/apache/axis/encoding/ser/JAFDataHandlerSerializer.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- JAFDataHandlerSerializer.java     22 Feb 2002 23:39:44 -0000      1.4
  +++ JAFDataHandlerSerializer.java     24 May 2002 12:53:18 -0000      1.5
  @@ -113,7 +113,7 @@
           String href= attachmentPart.getContentId();
   
           AttributesImpl attrs = new AttributesImpl();
  -        if (attributes != null)
  +        if (attributes != null && 0 < attributes.getLength())
               attrs.setAttributes(attributes); //copy the existing ones.
   
           int typeIndex=-1;
  
  
  
  1.59      +18 -13    xml-axis/java/src/org/apache/axis/transport/http/HTTPSender.java
  
  Index: HTTPSender.java
  ===================================================================
  RCS file: 
/home/cvs/xml-axis/java/src/org/apache/axis/transport/http/HTTPSender.java,v
  retrieving revision 1.58
  retrieving revision 1.59
  diff -u -r1.58 -r1.59
  --- HTTPSender.java   21 May 2002 13:20:36 -0000      1.58
  +++ HTTPSender.java   24 May 2002 12:53:18 -0000      1.59
  @@ -121,21 +121,26 @@
               String host = tmpURL.getHost();
               Socket sock = null;
   
  -            // create socket based on the url protocol type
  -            if (tmpURL.getProtocol().equalsIgnoreCase("https")) {
  -                sock = getSecureSocket(host, tmpURL);
  -            } else {
  -                sock = getSocket(host, tmpURL, otherHeaders, useFullURL);
  -            }
  +            try{
   
  -            // optionally set a timeout for the request
  -            if (msgContext.getTimeout() != 0) {
  -                sock.setSoTimeout(msgContext.getTimeout());
  -            }
  +                // create socket based on the url protocol type
  +                if (tmpURL.getProtocol().equalsIgnoreCase("https")) {
  +                    sock = getSecureSocket(host, tmpURL);
  +                } else {
  +                    sock = getSocket(host, tmpURL, otherHeaders, useFullURL);
  +                }
   
  -            // Send the SOAP request to the server
  -            writeToSocket(sock, msgContext, tmpURL, otherHeaders, host,
  -                    useFullURL);
  +                // optionally set a timeout for the request
  +                if (msgContext.getTimeout() != 0) {
  +                    sock.setSoTimeout(msgContext.getTimeout());
  +                }
  +
  +                // Send the SOAP request to the server
  +                writeToSocket(sock, msgContext, tmpURL, otherHeaders, host,
  +                        useFullURL);
  +           }finally{
  +             if(null != sock) sock.shutdownOutput(); //need to change for http 1.1
  +           }
   
               // Read the response back from the server
               readFromSocket(sock, msgContext);
  
  
  


Reply via email to