axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rineh...@apache.org
Subject cvs commit: xml-axis/java/src/org/apache/axis/encoding JAFDataHandlerSerializer.java
Date Sun, 11 Nov 2001 21:24:30 GMT
rineholt    01/11/11 13:24:30

  Modified:    java/src/org/apache/axis Message.java
               java/src/org/apache/axis/attachments
                        BoundaryDelimitedStream.java
               java/src/org/apache/axis/encoding
                        JAFDataHandlerSerializer.java
  Log:
  Don't send XSI type with attachments.  Debug out  boundary streams
  Make sure attachments are in the stream.
  
  Revision  Changes    Path
  1.54      +3 -5      xml-axis/java/src/org/apache/axis/Message.java
  
  Index: Message.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/Message.java,v
  retrieving revision 1.53
  retrieving revision 1.54
  diff -u -r1.53 -r1.54
  --- Message.java	2001/11/07 12:00:00	1.53
  +++ Message.java	2001/11/11 21:24:30	1.54
  @@ -246,11 +246,9 @@
       return ret;
     }
     public int getContentLength() throws org.apache.axis.AxisFault{ //This will have to give
way someday to HTTP Chunking but for now kludge.
  -    int ret= 0; 
  -    if(mAttachments == null ||   0== mAttachments.getAttachmentCount()){
  -      ret= mSOAPPart.getAsBytes().length; 
  -    }else{
  -        ret= mAttachments.getContentLength();
  +      int ret= mSOAPPart.getAsBytes().length; //Force serialization if it hasn't happend
it. //Rick Rineholt fix this later.
  +      if(mAttachments != null &&   0 < mAttachments.getAttachmentCount()){
  +          ret= mAttachments.getContentLength();
       }
       return ret;
     }
  
  
  
  1.2       +20 -5     xml-axis/java/src/org/apache/axis/attachments/BoundaryDelimitedStream.java
  
  Index: BoundaryDelimitedStream.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/attachments/BoundaryDelimitedStream.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- BoundaryDelimitedStream.java	2001/11/06 20:06:02	1.1
  +++ BoundaryDelimitedStream.java	2001/11/11 21:24:30	1.2
  @@ -54,6 +54,7 @@
    */
   
   package org.apache.axis.attachments;
  +import org.apache.log4j.Category;
   
   /**
    * @author Rick Rineholt 
  @@ -79,6 +80,15 @@
                                      // Where in the stream a boundary is located.
       int boundaryPos = BOUNDARY_NOT_FOUND;
   
  +    static int streamCount= 0; //number of streams produced.
  +    protected synchronized static int newStreamNo(){
  +        return ++ streamCount;
  +    }
  +    protected int streamNo=-1; //Keeps track of stream
  +
  +    static Category category =
  +            Category.getInstance(BoundaryDelimitedStream.class.getName());
  +
       /**
        * Gets the next stream. From the previous using the same buffer size to read.
        * @return the boundary delmited stream. Null if there are no more streams.
  @@ -106,6 +116,8 @@
       protected BoundaryDelimitedStream(BoundaryDelimitedStream prev,
         int readbufsz ) {
           super (prev.is);
  +
  +        streamNo= newStreamNo();
           boundary = prev.boundary;
           boundaryLen = prev.boundaryLen;
           boundaryBufLen = prev.boundaryBufLen;
  @@ -132,6 +144,7 @@
        BoundaryDelimitedStream( java.io.InputStream is, byte[] boundary,
         int readbufsz) throws org.apache.axis.AxisFault {
           super (is);
  +        streamNo= newStreamNo();
           closed = false;
           this.is = is;
           this.boundary = boundary;
  @@ -140,8 +153,6 @@
             //allways leave room for at least a 2x boundary
             //Most mime boundaries are 40 bytes or so.
           this.readbufsz = Math.max( (boundaryBufLen) * 2, readbufsz); 
  -                                                                    
  -
       }
        
       /**
  @@ -159,6 +170,7 @@
           if (readbuf == null) { //Allocate the buffer.
               readbuf = new byte[Math.max(len, readbufsz ) ];
               readBufEnd = is.read(readbuf);
  +            if( readBufEnd < 0) throw new java.io.IOException( "End of stream encountered
before final boundary marker."); 
               readBufPos = 0;
                                                          //Finds the boundary pos.
               boundaryPos = boundaryPosition( readbuf, 0, readBufEnd);
  @@ -190,6 +202,8 @@
                   System.arraycopy(readbuf, readBufPos, dstbuf, 0, movecnt);
                   //Read in the new data.
                   int readcnt = is.read(dstbuf, movecnt, dstbuf.length - movecnt);
  +                
  +                if( readcnt < 0) throw new java.io.IOException( "End of stream encountered
before final boundary marker."); 
   
                   readBufEnd = readcnt + movecnt;
                   readbuf = dstbuf;
  @@ -204,16 +218,17 @@
           //read till we get the amount or the stream is finished.
           while ( !eos && bwritten < len );
   
  -        if (false) {
  +        if (category.isDebugEnabled()) {
               if (bwritten  > 0) {
                   byte tb[] = new byte[bwritten];
   
                   System.arraycopy(b, off, tb, 0, bwritten);
  -                System.err.println("read(" + bwritten + ") \"" + 
  +                category.debug("Read " + bwritten +
  +                " from BoundaryDelimitedStream:"+ streamNo+"\"" + 
                   new String(tb) + "\"");
  -                System.err.flush();
               }
           }
  +
           return bwritten;
       }
   
  
  
  
  1.2       +9 -0      xml-axis/java/src/org/apache/axis/encoding/JAFDataHandlerSerializer.java
  
  Index: JAFDataHandlerSerializer.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/JAFDataHandlerSerializer.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JAFDataHandlerSerializer.java	2001/11/10 03:35:41	1.1
  +++ JAFDataHandlerSerializer.java	2001/11/11 21:24:30	1.2
  @@ -90,6 +90,15 @@
           AttributesImpl attrs = new AttributesImpl();
           if (attributes != null)
               attrs.setAttributes(attributes); //copy the existing ones.
  +
  +        int typeIndex=-1;
  +        if((typeIndex = attrs.getIndex(Constants.URI_CURRENT_SCHEMA_XSI,
  +                                "type")) != -1){
  +
  +            //Found a xsi:type which should not be there for attachments.             
          
  +            attrs.removeAttribute(typeIndex);
  +        }                        
  +
           attrs.addAttribute("", Constants.ATTR_HREF, "href",
                                  "CDATA", href);
   
  
  
  

Mime
View raw message