HttpUrl Input/Output stream problems

View: New views
4 Messages — Rating Filter:   Alert me  

HttpUrl Input/Output stream problems

by Alistair Young :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi there,

I have an interesting problem and was wondering if anyone's seen it  
before? I'm saving a document to an HttpUrl output stream and then  
reading the result from the server and parsing a new document:

XmlOptions xmlOptions = new XmlOptions();
xmlOptions.setSavePrettyPrint();
xmlOptions.setSavePrettyPrintIndent(2);
xmlOptions.setUseDefaultNamespace();
...
OutputStream out = httpURL.getOutputStream();
efDoc.save(out, xmlOptions);
out.flush();
...
InputStream in = httpURL.getInputStream();
EframeworkDocument efResponseDoc = EframeworkDocument.Factory.parse(in);

it works fine the first 2 times. The 3rd time the server always  
throws this exception:

org.apache.xmlbeans.XmlException: error: Unexpected end of file after  
null

when it does:

SomeDocument doc = SomeDocument.Factory.parse(request.getInputStream());

thanks,

Alistair


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@...
For additional commands, e-mail: user-help@...


RE: HttpUrl Input/Output stream problems

by Radu Preotiuc-Pietro :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

This exception comes from the parser and seems to indicate that the
stream gets truncated. Is there any way you can look at what the http
request looks like or replace the XMLBeans parse with a stream dump? I
am pretty sure that it's not a parse problem per se.

Radu

-----Original Message-----
From: Alistair Young [mailto:alistair@...]
Sent: Friday, October 27, 2006 3:33 AM
To: user@...
Subject: HttpUrl Input/Output stream problems

Hi there,

I have an interesting problem and was wondering if anyone's seen it
before? I'm saving a document to an HttpUrl output stream and then
reading the result from the server and parsing a new document:

XmlOptions xmlOptions = new XmlOptions();
xmlOptions.setSavePrettyPrint(); xmlOptions.setSavePrettyPrintIndent(2);
xmlOptions.setUseDefaultNamespace();
...
OutputStream out = httpURL.getOutputStream(); efDoc.save(out,
xmlOptions); out.flush(); ...
InputStream in = httpURL.getInputStream(); EframeworkDocument
efResponseDoc = EframeworkDocument.Factory.parse(in);

it works fine the first 2 times. The 3rd time the server always throws
this exception:

org.apache.xmlbeans.XmlException: error: Unexpected end of file after
null

when it does:

SomeDocument doc = SomeDocument.Factory.parse(request.getInputStream());

thanks,

Alistair


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@...
For additional commands, e-mail: user-help@...

_______________________________________________________________________
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@...
For additional commands, e-mail: user-help@...


Re: HttpUrl Input/Output stream problems

by emfoss :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

We had a similar issue. There appears to be some sort of resource leak  with the Parse(inputStream) methods.
By changing:
Alistair Young wrote:
...
SomeDocument doc = SomeDocument.Factory.parse(request.getInputStream());

...
To

theString= aMethodToConvertToString(request.getInputStream());
SomeDocument doc = SomeDocument.Factory.parse(theString);

we eliminated the behaviour.

Re: HttpUrl Input/Output stream problems

by Alistair Young :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

thanks for that tip - I'll give it a go

Alistair


--------------
mov eax,1
mov ebx,0
int 80h




On 30 Nov 2006, at 23:51, emfoss wrote:


We had a similar issue. There appears to be some sort of resource leak  with
the Parse(inputStream) methods.
By changing:

Alistair Young wrote:

...
SomeDocument doc = SomeDocument.Factory.parse(request.getInputStream());

...


To 

theString= aMethodToConvertToString(request.getInputStream());
SomeDocument doc = SomeDocument.Factory.parse(theString);

we eliminated the behaviour.

-- 
Sent from the Xml Beans - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@...
For additional commands, e-mail: user-help@...