Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Strange behavior with XtextSerializationException
Strange behavior with XtextSerializationException [message #732293] Tue, 04 October 2011 12:48 Go to next message
Daniel Trierweiler is currently offline Daniel TrierweilerFriend
Messages: 67
Registered: June 2011
Member
Hey guys,

I've got a question related to the XtextSerializationException. If I serialize my model and it serialization does not work, it throws:

org.eclipse.xtext.parsetree.reconstr.XtextSerializationException: Serialization failed


This occurs when I call:
try {
 resource.save(Collections.EMPTY_MAP);
} catch (IOException e) {
 e.printStackTrace();
}


Sadly the results are, that my file is overwritten, which I don't want to happen. Is it possible to tell Xtext to break on a serialization failure?

Thanks for your help Smile

Cheers,
Daniel
Re: Strange behavior with XtextSerializationException [message #733393 is a reply to message #732293] Tue, 04 October 2011 15:48 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi Daniel,

please file a ticket.
Workaround: Serialize to a Byte array and pump that into the file if the
serialization succeeded.

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

On 04.10.11 14:48, Daniel Trierweiler wrote:
> Hey guys,
>
> I've got a question related to the XtextSerializationException. If I
> serialize my model and it serialization does not work, it throws:
>
> org.eclipse.xtext.parsetree.reconstr.XtextSerializationException:
> Serialization failed
>
> This occurs when I call:
> try {
> resource.save(Collections.EMPTY_MAP);
> } catch (IOException e) {
> e.printStackTrace();
> }
>
> Sadly the results are, that my file is overwritten, which I don't want
> to happen. Is it possible to tell Xtext to break on a serialization
> failure?
>
> Thanks for your help :)
>
> Cheers,
> Daniel
Re: Strange behavior with XtextSerializationException [message #733673 is a reply to message #733393] Wed, 05 October 2011 12:01 Go to previous messageGo to next message
Daniel Trierweiler is currently offline Daniel TrierweilerFriend
Messages: 67
Registered: June 2011
Member
https://bugs.eclipse.org/bugs/show_bug.cgi?id=359969
Re: Strange behavior with XtextSerializationException [message #736730 is a reply to message #733673] Fri, 14 October 2011 09:23 Go to previous messageGo to next message
Daniel Trierweiler is currently offline Daniel TrierweilerFriend
Messages: 67
Registered: June 2011
Member
Sebastian, is there any kind of example for that? Actually I don't know how to get the results from the serializer.

Thanks a lot!
Daniel

[Updated on: Fri, 14 October 2011 09:24]

Report message to a moderator

Re: Strange behavior with XtextSerializationException [message #736735 is a reply to message #736730] Fri, 14 October 2011 09:30 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

just use the Resource save(OutputStream outputStream, Map<?, ?> options)
e.g. with a ByteArrayOutputStream

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:create document for xtext grammar
Next Topic:Qualified Name Provider
Goto Forum:
  


Current Time: Fri Apr 26 08:37:47 GMT 2024

Powered by FUDForum. Page generated in 0.03260 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top