IMPORTANT:
this is not a Support Forum! Experienced users might answer from time to time questions posted here. If you need a professional and reliable answer, or if you want to report a bug, please contact Altova Support instead.

Problem with closed result stream Options · View
Grovah
Posted: Friday, February 3, 2012 11:09:08 AM
Rank: Member

Joined: 5/27/2011
Posts: 10
Location: Sweden
Hello!

I have two MapForce mappings, one xml-->xml, and one xml-->text. Both mappings are generated code for and compiled to DLL:s.

In VS10 (C#), I execute the mappings using memory streams as input and output:
xmlToXmlMapping.CloseObjectsAfterRun = false;
MemoryStream resultStream = new MemoryStream();
MemoryStream myMemoryStream = new MemoryStream();
myMemoryStream = GetMemStreamFromObject(obj);
Altova.IO.StreamInput inputStream = new Altova.IO.StreamInput(myMemoryStream);
Altova.IO.StreamOutput outputStream = new Altova.IO.StreamOutput(resultStream);
xmlToXmlMapping.Run(inputStream, outputStream);
//Here outputStream is open and readable



xmlToTxtMapping.CloseObjectsAfterRun = false;
MemoryStream resultStream = new MemoryStream();
MemoryStream myMemoryStream = new MemoryStream();
myMemoryStream = GetMemStreamFromObject(obj);
Altova.IO.StreamInput inputStream = new Altova.IO.StreamInput(myMemoryStream);
Altova.IO.StreamOutput outputStream = new Altova.IO.StreamOutput(resultStream);
xmlToTxtMapping.Run(inputStream, outputStream);
//Here outputStream is closed

For the xml-->xml mapping, the output stream is open and readable after executing the Run method. For the xml-->text mapping, the output stream is closed when its returned from the mapping.

To eliminate that it is the mappings that fails, I have executed both theese mappings from code using strings as input with the file paths to the Run method. That works fine and the mappings creates the resultfile as it should. I have also used StringInput/StringOutput as parameters and that also works as it should, I get a StringBuilder object back from the Run method with the desired content from the mappings. Could this be a bug or is it me doing something wrong here when calling the xml-->text mapping?

Regards
/Grovah

EDIT:
This is the exception when checking the length on the stream returned from the XML-->text mapping:
"Exception: System.ObjectDisposedException: Det går inte att komma åt en stängd dataström (in english: It is not possible to reach a closed data stream).
vid System.IO.__Error.StreamIsClosed()
vid System.IO.MemoryStream.get_Length()
vid Engine.FileConverterRunner.ExecuteMapForceJob(FileConverterJob job)"

As described in the original post, calling the xml-->xml mapping, the stream is open and I can check the length property without exception.

Grovah
Posted: Wednesday, February 15, 2012 10:24:51 AM
Rank: Member

Joined: 5/27/2011
Posts: 10
Location: Sweden
For information
The problem with the closed stream is confirmed by Altova to be a bug (#38755) and will be adressed in future release.

Solved it temporary by using string as input and stringbulder as output from the mapping instead of streams.

/Grovah
Saroop
Posted: Tuesday, February 28, 2012 6:02:21 AM
Rank: Newbie

Joined: 9/16/2011
Posts: 3
Location: India
Hello AltovaTeam,

Currently I am working with altova Mapforce2012 sp1 for mapping.My input and output is in Stream base. It's working fine but in same case of data file processing the Closed Stream exception raise. I open my Stream in between using(),But still facing this issue. may i know from where i find the altova bug report list? So I inform to my Other technical team member. If it's resolved then which Altova Mapforce version I would download for mapping.

vlad
Posted: Tuesday, February 28, 2012 9:01:07 AM
Rank: Advanced Member

Joined: 12/13/2005
Posts: 2,856
Location: Mauritius
Saroop, for Altova Team contact Altova Support with your question, not User Forum
Users browsing this topic
guest

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Use of the Altova User Forum(s) is governed by the Altova Terms of Use.