Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » [xtext] problem saving a model to dsl file
icon9.gif  [xtext] problem saving a model to dsl file [message #1424204] Mon, 15 September 2014 16:35 Go to next message
Nikos Mising name is currently offline Nikos Mising nameFriend
Messages: 11
Registered: July 2009
Junior Member
Dear all,

I have defined a DSL (gorgiasdsl) and generated the xtext artifacts. I can load a model and manipulate it using EMF. However, when it comes to saving the model I get a "ValueConverterWithValueException: String literal is not properly closed" error.

What can be the problem?

I attach my code and the StackTrace:

//load model fro dsl
Injector injector = new GorgiasDslStandaloneSetup().createInjectorAndDoEMFRegistration();
XtextResourceSet resourceSet = injector.getInstance(XtextResourceSet.class);
resourceSet.addLoadOption(XtextResource.OPTION_RESOLVE_ALL, Boolean.TRUE);
Resource resource = resourceSet.getResource(URI.createURI("file:///C:\\kb.gorgiasdsl"), true);
GorgiasProgram model = (GorgiasProgram) resource.getContents().get(0);
//model is correct
//save model
try {
 HashMap saveOptions = new HashMap();
 saveOptions.put(XtextResource.OPTION_ENCODING, "UTF8");
 resource.save(new FileOutputStream("myapplication.gorgiasdsl"), saveOptions);		} catch (IOException e) {
 // TODO Auto-generated catch block
 e.printStackTrace();
}


Exception in thread "main" org.eclipse.xtext.conversion.ValueConverterWithValueException: String literal is not properly closed
	at org.eclipse.xtext.conversion.impl.STRINGValueConverter.convertFromString(STRINGValueConverter.java:184)
	at org.eclipse.xtext.conversion.impl.STRINGValueConverter.toValue(STRINGValueConverter.java:32)
	at org.eclipse.xtext.conversion.impl.STRINGValueConverter.toValue(STRINGValueConverter.java:1)
	at org.eclipse.xtext.conversion.impl.AbstractDeclarativeValueConverterService.toValue(AbstractDeclarativeValueConverterService.java:72)
	at org.eclipse.xtext.serializer.tokens.ValueSerializer.serializeAssignedValue(ValueSerializer.java:52)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.getToken(SequenceFeeder.java:462)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.accept(SequenceFeeder.java:220)
	at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.accept(BacktrackingSemanticSequencer.java:407)
	at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.createSequence(BacktrackingSemanticSequencer.java:449)
	at gr.tuc.amcl.xtext.gorgiasdsl.serializer.GorgiasDslSemanticSequencer.sequence_Term(GorgiasDslSemanticSequencer.java:349)
	at gr.tuc.amcl.xtext.gorgiasdsl.serializer.GorgiasDslSemanticSequencer.createSequence(GorgiasDslSemanticSequencer.java:143)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptEObjectRuleCall(SequenceFeeder.java:299)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptRuleCall(SequenceFeeder.java:325)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.accept(SequenceFeeder.java:239)
	at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.accept(BacktrackingSemanticSequencer.java:400)
	at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.createSequence(BacktrackingSemanticSequencer.java:449)
	at gr.tuc.amcl.xtext.gorgiasdsl.serializer.GorgiasDslSemanticSequencer.sequence_TermList(GorgiasDslSemanticSequencer.java:340)
	at gr.tuc.amcl.xtext.gorgiasdsl.serializer.GorgiasDslSemanticSequencer.createSequence(GorgiasDslSemanticSequencer.java:149)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptEObjectRuleCall(SequenceFeeder.java:299)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptRuleCall(SequenceFeeder.java:325)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.accept(SequenceFeeder.java:222)
	at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.accept(BacktrackingSemanticSequencer.java:407)
	at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.createSequence(BacktrackingSemanticSequencer.java:449)
	at gr.tuc.amcl.xtext.gorgiasdsl.serializer.GorgiasDslSemanticSequencer.sequence_Predicate(GorgiasDslSemanticSequencer.java:288)
	at gr.tuc.amcl.xtext.gorgiasdsl.serializer.GorgiasDslSemanticSequencer.createSequence(GorgiasDslSemanticSequencer.java:101)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptEObjectRuleCall(SequenceFeeder.java:299)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptRuleCall(SequenceFeeder.java:325)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.accept(SequenceFeeder.java:222)
	at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.accept(BacktrackingSemanticSequencer.java:407)
	at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.createSequence(BacktrackingSemanticSequencer.java:449)
	at gr.tuc.amcl.xtext.gorgiasdsl.serializer.GorgiasDslSemanticSequencer.sequence_Clause(GorgiasDslSemanticSequencer.java:178)
	at gr.tuc.amcl.xtext.gorgiasdsl.serializer.GorgiasDslSemanticSequencer.createSequence(GorgiasDslSemanticSequencer.java:53)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptEObjectRuleCall(SequenceFeeder.java:299)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptRuleCall(SequenceFeeder.java:325)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.accept(SequenceFeeder.java:239)
	at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.accept(BacktrackingSemanticSequencer.java:400)
	at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.createSequence(BacktrackingSemanticSequencer.java:449)
	at gr.tuc.amcl.xtext.gorgiasdsl.serializer.GorgiasDslSemanticSequencer.sequence_GorgiasProgram(GorgiasDslSemanticSequencer.java:236)
	at gr.tuc.amcl.xtext.gorgiasdsl.serializer.GorgiasDslSemanticSequencer.createSequence(GorgiasDslSemanticSequencer.java:83)
	at org.eclipse.xtext.serializer.impl.Serializer.serialize(Serializer.java:85)
	at org.eclipse.xtext.serializer.impl.Serializer.serialize(Serializer.java:108)
	at org.eclipse.xtext.serializer.impl.Serializer.serialize(Serializer.java:130)
	at org.eclipse.xtext.resource.XtextResource.doSave(XtextResource.java:336)
	at org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(ResourceImpl.java:1430)
	at Test.main(Test.java:65)

[Updated on: Mon, 15 September 2014 16:36]

Report message to a moderator

Re: "ValueConverterWithValueException: String literal is not properly closed" when [message #1424208 is a reply to message #1424204] Mon, 15 September 2014 16:42 Go to previous message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3104
Registered: July 2009
Senior Member
Hi,

please set a breakpoint in
ValueSerializer.serializeAssignedValue(EObject, RuleCall, Object, INode,
Acceptor) and try to figure out what's wrong with the node.
Except from that, I think there is a missing try-catch in the framework
code. Could you please file a ticket?
To workaround that one, you may want to specialize the ValueSerializer
and override the questionable method.

Regards,
Sebastian
--
Looking for professional support for Xtext, Xtend or Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 15.09.14 18:35, schrieb Nikos Mising name:
> Dear all,
>
> I have defined a DSL (gorgiasdsl) and generated the xtext artifacts. I
> can load a model and manipulate it using EMF. However, when it comes to
> saving the model I get a "ValueConverterWithValueException: String
> literal is not properly closed" error.
> What can be the problem?
> I attach my code and the StackTrace:
>
>
> //load model fro dsl
> Injector injector = new
> GorgiasDslStandaloneSetup().createInjectorAndDoEMFRegistration();
> XtextResourceSet resourceSet =
> injector.getInstance(XtextResourceSet.class);
> resourceSet.addLoadOption(XtextResource.OPTION_RESOLVE_ALL, Boolean.TRUE);
> Resource resource =
> resourceSet.getResource(URI.createURI("file:///C:\\kb.gorgiasdsl"), true);
> GorgiasProgram model = (GorgiasProgram) resource.getContents().get(0);
> //model is correct
> //save model
> try {
> HashMap saveOptions = new HashMap();
> saveOptions.put(XtextResource.OPTION_ENCODING, "UTF8");
> resource.save(new FileOutputStream("myapplication.gorgiasdsl"),
> saveOptions); } catch (IOException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
>
>
> Exception in thread "main"
> org.eclipse.xtext.conversion.ValueConverterWithValueException: String
> literal is not properly closed
> at
> org.eclipse.xtext.conversion.impl.STRINGValueConverter.convertFromString(STRINGValueConverter.java:184)
>
> at
> org.eclipse.xtext.conversion.impl.STRINGValueConverter.toValue(STRINGValueConverter.java:32)
>
> at
> org.eclipse.xtext.conversion.impl.STRINGValueConverter.toValue(STRINGValueConverter.java:1)
>
> at
> org.eclipse.xtext.conversion.impl.AbstractDeclarativeValueConverterService.toValue(AbstractDeclarativeValueConverterService.java:72)
>
> at
> org.eclipse.xtext.serializer.tokens.ValueSerializer.serializeAssignedValue(ValueSerializer.java:52)
>
> at
> org.eclipse.xtext.serializer.acceptor.SequenceFeeder.getToken(SequenceFeeder.java:462)
>
> at
> org.eclipse.xtext.serializer.acceptor.SequenceFeeder.accept(SequenceFeeder.java:220)
>
> at
> org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.accept(BacktrackingSemanticSequencer.java:407)
>
> at
> org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.createSequence(BacktrackingSemanticSequencer.java:449)
>
> at
> gr.tuc.amcl.xtext.gorgiasdsl.serializer.GorgiasDslSemanticSequencer.sequence_Term(GorgiasDslSemanticSequencer.java:349)
>
> at
> gr.tuc.amcl.xtext.gorgiasdsl.serializer.GorgiasDslSemanticSequencer.createSequence(GorgiasDslSemanticSequencer.java:143)
>
> at
> org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptEObjectRuleCall(SequenceFeeder.java:299)
>
> at
> org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptRuleCall(SequenceFeeder.java:325)
>
> at
> org.eclipse.xtext.serializer.acceptor.SequenceFeeder.accept(SequenceFeeder.java:239)
>
> at
> org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.accept(BacktrackingSemanticSequencer.java:400)
>
> at
> org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.createSequence(BacktrackingSemanticSequencer.java:449)
>
> at
> gr.tuc.amcl.xtext.gorgiasdsl.serializer.GorgiasDslSemanticSequencer.sequence_TermList(GorgiasDslSemanticSequencer.java:340)
>
> at
> gr.tuc.amcl.xtext.gorgiasdsl.serializer.GorgiasDslSemanticSequencer.createSequence(GorgiasDslSemanticSequencer.java:149)
>
> at
> org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptEObjectRuleCall(SequenceFeeder.java:299)
>
> at
> org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptRuleCall(SequenceFeeder.java:325)
>
> at
> org.eclipse.xtext.serializer.acceptor.SequenceFeeder.accept(SequenceFeeder.java:222)
>
> at
> org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.accept(BacktrackingSemanticSequencer.java:407)
>
> at
> org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.createSequence(BacktrackingSemanticSequencer.java:449)
>
> at
> gr.tuc.amcl.xtext.gorgiasdsl.serializer.GorgiasDslSemanticSequencer.sequence_Predicate(GorgiasDslSemanticSequencer.java:288)
>
> at
> gr.tuc.amcl.xtext.gorgiasdsl.serializer.GorgiasDslSemanticSequencer.createSequence(GorgiasDslSemanticSequencer.java:101)
>
> at
> org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptEObjectRuleCall(SequenceFeeder.java:299)
>
> at
> org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptRuleCall(SequenceFeeder.java:325)
>
> at
> org.eclipse.xtext.serializer.acceptor.SequenceFeeder.accept(SequenceFeeder.java:222)
>
> at
> org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.accept(BacktrackingSemanticSequencer.java:407)
>
> at
> org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.createSequence(BacktrackingSemanticSequencer.java:449)
>
> at
> gr.tuc.amcl.xtext.gorgiasdsl.serializer.GorgiasDslSemanticSequencer.sequence_Clause(GorgiasDslSemanticSequencer.java:178)
>
> at
> gr.tuc.amcl.xtext.gorgiasdsl.serializer.GorgiasDslSemanticSequencer.createSequence(GorgiasDslSemanticSequencer.java:53)
>
> at
> org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptEObjectRuleCall(SequenceFeeder.java:299)
>
> at
> org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptRuleCall(SequenceFeeder.java:325)
>
> at
> org.eclipse.xtext.serializer.acceptor.SequenceFeeder.accept(SequenceFeeder.java:239)
>
> at
> org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.accept(BacktrackingSemanticSequencer.java:400)
>
> at
> org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.createSequence(BacktrackingSemanticSequencer.java:449)
>
> at
> gr.tuc.amcl.xtext.gorgiasdsl.serializer.GorgiasDslSemanticSequencer.sequence_GorgiasProgram(GorgiasDslSemanticSequencer.java:236)
>
> at
> gr.tuc.amcl.xtext.gorgiasdsl.serializer.GorgiasDslSemanticSequencer.createSequence(GorgiasDslSemanticSequencer.java:83)
>
> at
> org.eclipse.xtext.serializer.impl.Serializer.serialize(Serializer.java:85)
> at
> org.eclipse.xtext.serializer.impl.Serializer.serialize(Serializer.java:108)
> at
> org.eclipse.xtext.serializer.impl.Serializer.serialize(Serializer.java:130)
> at
> org.eclipse.xtext.resource.XtextResource.doSave(XtextResource.java:336)
> at
> org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(ResourceImpl.java:1430)
>
> at Test.main(Test.java:65)
>
Previous Topic:[shameless plug] MDD-related conference in .nl
Next Topic:Xtext example how to configure validation via preferences
Goto Forum:
  


Current Time: Sun Dec 08 04:51:10 GMT 2019

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

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

Back to the top