You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-dev@xml.apache.org by du...@apache.org on 2001/04/22 03:25:58 UTC

cvs commit: xml-soap/java/src/org/apache/soap/util/xml XMISerializer.java

dug         01/04/21 18:25:58

  Modified:    java/src/org/apache/soap/util/xml XMISerializer.java
  Log:
  Minor threading fix by Gordon D. Aspin (gaspin@dc.com)
  
  Revision  Changes    Path
  1.7       +26 -19    xml-soap/java/src/org/apache/soap/util/xml/XMISerializer.java
  
  Index: XMISerializer.java
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/src/org/apache/soap/util/xml/XMISerializer.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- XMISerializer.java	2001/03/23 07:46:37	1.6
  +++ XMISerializer.java	2001/04/22 01:25:58	1.7
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 2000 The Apache Software Foundation.  All rights 
  + * Copyright (c) 2000 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -10,7 +10,7 @@
    * are met:
    *
    * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer. 
  + *    notice, this list of conditions and the following disclaimer.
    *
    * 2. Redistributions in binary form must reproduce the above copyright
    *    notice, this list of conditions and the following disclaimer in
  @@ -18,7 +18,7 @@
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  - *    if any, must include the following acknowledgment:  
  + *    if any, must include the following acknowledgment:
    *       "This product includes software developed by the
    *        Apache Software Foundation (http://www.apache.org/)."
    *    Alternately, this acknowledgment may appear in the software itself,
  @@ -26,7 +26,7 @@
    *
    * 4. The names "SOAP" and "Apache Software Foundation" must
    *    not be used to endorse or promote products derived from this
  - *    software without prior written permission. For written 
  + *    software without prior written permission. For written
    *    permission, please contact apache@apache.org.
    *
    * 5. Products derived from this software may not be called "Apache",
  @@ -71,6 +71,7 @@
   public class XMISerializer implements Serializer
   {
     public static int CONV_BSIZE=0x400;
  +  private static XercesParserLiaison xpl = null;
   
     public void marshall(String inScopeEncStyle, Class javaType, Object src,
                          Object context, Writer sink, NSStack nsStack,
  @@ -85,42 +86,48 @@
       // ignoring context
   
       // special case for Strings - otherwise treated as uuids by the serializer
  -    
  +
  +    if( xpl == null )
  +      xpl = new  XercesParserLiaison();
  +
       if (src == null)
       {
         sink.write("<null type=\"" + javaType.getName() + "\"/>");
         return;
       }
       else if( javaType ==java.lang.String.class )
  -    {   
  +    {
         sink.write("<java.lang.String value='" + src + "' />");
         return;
       }
  -    
  -    System.err.println(src);
  +
  +    //System.err.println(src);
       Vector olist = new Vector();
       olist.addElement(src);
  -    
  -    
  -    PipedOutputStream tmpout = new PipedOutputStream();
  -    PipedInputStream tmpin  = new PipedInputStream();
  -    
  -    tmpin.connect(tmpout);
   
  +
  +    ByteArrayOutputStream tmpout = new ByteArrayOutputStream();
  +    // removed: GDA 4/17/2001 PipedOutputStream tmpout  = new PipedOutputStream();
  +    // removed: GDA 4/17/2001 PipedInputStream tmpin  = new PipedInputStream();
  +
  +    // removed: GDA 4/17/2001 tmpin.connect(tmpout);
  +
       Job.writeObjects((List)olist, (OutputStream)tmpout);
  -               
  +    sink.write(tmpout.toString());
  +
  +    /* block removed: GDA 4/17/2001
       byte[] readinto = new byte[XMISerializer.CONV_BSIZE];
       int len, left = 0;
  -    
  +
       while( (left = tmpin.available())> 0 )
         {
           len = tmpin.read(readinto, 0, Math.min(left, XMISerializer.CONV_BSIZE));
           String convert = new String(readinto, 0, len);
           sink.write(convert);
         }
  -    
  +    */
       tmpout.close();
  -    tmpin.close();
  +    // removed: GDA 4/17/2001 tmpin.close();
     }
  -  
  +
   }