You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ri...@apache.org on 2002/01/22 20:32:21 UTC
cvs commit: xml-axis/java/src/org/apache/axis/encoding JAFDataHandlerDeserializer.java
rineholt 02/01/22 11:32:21
Modified: java/src/org/apache/axis/attachments
BoundaryDelimitedStream.java MimeUtils.java
MultiPartRelatedInputStream.java
java/src/org/apache/axis/encoding
JAFDataHandlerDeserializer.java
Log:
Fix a bug when the SOAP stream itself is encoded.
Revision Changes Path
1.4 +7 -0 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.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- BoundaryDelimitedStream.java 16 Nov 2001 02:57:53 -0000 1.3
+++ BoundaryDelimitedStream.java 22 Jan 2002 19:32:20 -0000 1.4
@@ -82,12 +82,15 @@
static int streamCount= 0; //number of streams produced.
protected synchronized static int newStreamNo(){
+
+ category.debug("New boundary stream no:" + (streamCount +1));
return ++streamCount;
}
protected int streamNo=-1; //Keeps track of stream
static Category category =
Category.getInstance(BoundaryDelimitedStream.class.getName());
+ static boolean isDebugEnabled= false;
/**
* Gets the next stream. From the previous using the same buffer size to read.
@@ -118,6 +121,7 @@
super (prev.is);
streamNo= newStreamNo();
+
boundary = prev.boundary;
boundaryLen = prev.boundaryLen;
boundaryBufLen = prev.boundaryBufLen;
@@ -144,6 +148,7 @@
BoundaryDelimitedStream( java.io.InputStream is, byte[] boundary,
int readbufsz) throws org.apache.axis.AxisFault {
super (is);
+ isDebugEnabled= category.isDebugEnabled();
streamNo= newStreamNo();
closed = false;
this.is = is;
@@ -191,6 +196,7 @@
}
if (readBufPos == boundaryPos) {
eos = true; //hit the boundary so it the end of the stream.
+ category.debug("Boundary stream no:" + streamNo + " is at end of stream");
}
else if ( bwritten < len) { //need to get more data.
byte[]dstbuf = readbuf;
@@ -264,6 +270,7 @@
*/
public synchronized void close() throws java.io.IOException {
if (closed) return;
+ category.debug("Boundary stream no:" + streamNo + " is closed");
closed = true; //mark it closed.
if (!eos) { //We need get this off the stream.
//Easy way to flush through the stream;
1.6 +1 -1 xml-axis/java/src/org/apache/axis/attachments/MimeUtils.java
Index: MimeUtils.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/attachments/MimeUtils.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- MimeUtils.java 2 Dec 2001 19:22:49 -0000 1.5
+++ MimeUtils.java 22 Jan 2002 19:32:20 -0000 1.6
@@ -238,7 +238,7 @@
messageBodyPart.setText(env);
messageBodyPart.setHeader("Content-Type", "text/xml; charset=UTF-8" );
messageBodyPart.setHeader("Content-ID", "<" + rootCID + ">" );
- messageBodyPart.setHeader("Content-Transfer-Encoding", "8bit");
+ messageBodyPart.setHeader(HTTPConstants.HEADER_CONTENT_TRANSFER_ENCODING, "binary");
multipart.addBodyPart(messageBodyPart);
java.util.Set pe = parts.entrySet();
1.8 +8 -2 xml-axis/java/src/org/apache/axis/attachments/MultiPartRelatedInputStream.java
Index: MultiPartRelatedInputStream.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/attachments/MultiPartRelatedInputStream.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- MultiPartRelatedInputStream.java 18 Jan 2002 15:29:44 -0000 1.7
+++ MultiPartRelatedInputStream.java 22 Jan 2002 19:32:20 -0000 1.8
@@ -59,6 +59,7 @@
import javax.activation.DataHandler;
import org.apache.axis.Part;
import javax.mail.internet.MimeUtility;
+import org.apache.log4j.Category;
/**
@@ -80,12 +81,15 @@
//This stream controls and manages the boundary.
protected org.apache.axis.attachments.BoundaryDelimitedStream boundaryDelimitedStream = null;
protected java.io.InputStream soapStream = null; //Set the soap stream once found.
+ protected java.io.InputStream soapStreamBDS= null; //Set to the boundary delimited stream assoc. with soap stream once found.
protected byte[] boundary = null;
protected java.io.ByteArrayInputStream cachedSOAPEnvelope = null; //Caches the soap stream if it is
//Still open and a reference to read data in a later attachment occurs.
protected String contentLocation= null;
protected String contentId= null;
+ static Category category =
+ Category.getInstance(MultiPartRelatedInputStream.class.getName());
/**
* Multipart stream.
@@ -213,6 +217,7 @@
throw new org.apache.axis.AxisFault( "Root part containing SOAP envelope not found. contentId=" + rootPartContentId);
}
+ soapStreamBDS= boundaryDelimitedStream;
if(contentTransferEncoding != null && 0 != contentTransferEncoding.length()){
soapStream = MimeUtility.decode(boundaryDelimitedStream, contentTransferEncoding);
}else soapStream = boundaryDelimitedStream; //This should be the SOAP part
@@ -240,6 +245,7 @@
if ( null == ret) {
ret = readTillFound(id);
}
+ category.debug("getAttachmentByReference(\"" + id + "\") returns" + (ret == null? "null" : ret.toString()));
return ret;
}
@@ -270,7 +276,7 @@
Part ret = null;
try {
- if ( soapStream == boundaryDelimitedStream ) { //Still on the SOAP stream.
+ if ( soapStreamBDS == boundaryDelimitedStream ) { //Still on the SOAP stream.
if (!eos) { //The SOAP packet has not been fully read yet. Need to store it away.
java.io.ByteArrayOutputStream soapdata = new java.io.ByteArrayOutputStream(1024 * 8);
@@ -278,7 +284,7 @@
int byteread = 0;
do {
- byteread = boundaryDelimitedStream.read(buf);
+ byteread = soapStream.read(buf);
if (byteread > 0) soapdata.write(buf, 0, byteread);
}
while (byteread > -1);
1.3 +1 -0 xml-axis/java/src/org/apache/axis/encoding/JAFDataHandlerDeserializer.java
Index: JAFDataHandlerDeserializer.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/JAFDataHandlerDeserializer.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- JAFDataHandlerDeserializer.java 23 Dec 2001 12:33:32 -0000 1.2
+++ JAFDataHandlerDeserializer.java 22 Jan 2002 19:32:20 -0000 1.3
@@ -110,6 +110,7 @@
}
String href = attributes.getValue("href");
+ category.debug("href=" + href);
if (href != null) {
//isHref = true;
Object ref = context.getObjectByRef(href);