I'd expect that this is a bug in the WO Adaptor or in WO.  It could possibly be 
a bug in Java or Apache, but that seems less likely.  I'd suggest trying an 
update to WO 5.4.3 which has bug fixes for problems in 5.4.2.

Chuck


On Sep 15, 2010, at 4:14 PM, Yung-Luen Lan wrote:

> Hi,
> 
> The following code receives one chunk of multipart uploads and
> appending it to a file.
> (I have a client app which split the file first and then send the
> chunks one by one.)
> However, I got trouble when I deploy the code to a snow leopard
> machine. I found the file uploaded is not the same as the original
> file.
> 
> It seems that if there is byte '\0' occurred in the upload stream, the
> succeeding bytes all becomes zero.
> But this code used to work on both my old server (10.5, WO 5.4.2, Java
> 1.6 32bit) and dev machine (10.6, WO 5.4.2, Java 1.6 64bit)
> 
> What could possibly get wrong?
> 
> Regards,
> yllan
> 
> =====
> try {
>       WORequest r = context().request();
>       WOMultipartIterator iterator = r.multipartIterator();
>       WOMultipartIterator.WOFormData data = null;
>       NSData fileData = null;
> 
>       while ((data = iterator.nextFormData()) != null) {
>               if (data.isFileUpload()) {
>                       try {
>                               InputStream stream = data.formDataInputStream();
>                               fileData = new NSData(stream, 4096);
>                       } catch (Exception e) {
>                               return makeErrorXMLResponse(n, "UPLOAD: Failed 
> to read Data from Stream.");
>                       }
>               }
>       }
> 
>       if (fileData == null)
>               return makeErrorXMLResponse(n, "UPLOAD: Failed to read data 
> from request.");
> 
>       fileData.writeToStream(session().pdfStream());
> } catch (Exception e) {
>       return makeErrorXMLResponse(n, "UPLOAD: " + e.toString());
> }
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      ([email protected])
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/webobjects-dev/chill%40global-village.net
> 
> This email sent to [email protected]

-- 
Chuck Hill             Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their overall 
knowledge of WebObjects or who are trying to solve specific problems.    
http://www.global-village.net/products/practical_webobjects







Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to