Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo] An Acceleo-based generator built with Maven does not work on Obeo Designer 6.2
[Acceleo] An Acceleo-based generator built with Maven does not work on Obeo Designer 6.2 [message #1441209] Thu, 09 October 2014 11:53 Go to next message
Mary P. is currently offline Mary P.Friend
Messages: 48
Registered: November 2012
Member
Hello,
I have a graphical editor created with Obeo Designer and an Acceleo-based generator that generates text files from UML classes.
When I debug my application locally from Obeo, everything works fine.

But if I build my application using Maven and then install it on Obeo Designer as a plugin, then, whenever I try to generate a text file using my Acceleo-based generator, I get the following exception:

java.lang.StringIndexOutOfBoundsException: String index out of range: -1
	at java.lang.String.substring(String.java:1911)
	at org.eclipse.emf.ecore.impl.EModelElementImpl.eObjectForURIFragmentSegment(EModelElementImpl.java:417)
	at org.eclipse.emf.ecore.resource.impl.ResourceImpl.getEObject(ResourceImpl.java:774)
	at org.eclipse.emf.ecore.resource.impl.ResourceImpl.getEObject(ResourceImpl.java:750)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.setValueFromId(XMLHandler.java:2811)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.setAttribValue(XMLHandler.java:2716)
	at org.eclipse.emf.ecore.xmi.impl.SAXXMIHandler.handleObjectAttribs(SAXXMIHandler.java:79)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectFromFactory(XMLHandler.java:2188)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectFromFeatureType(XMLHandler.java:2154)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObject(XMLHandler.java:2030)
	at org.eclipse.emf.ecore.xmi.impl.XMIHandler.createObject(XMIHandler.java:128)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleFeature(XMLHandler.java:1809)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:1018)
	at org.eclipse.emf.ecore.xmi.impl.XMIHandler.processElement(XMIHandler.java:81)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:996)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:707)
	at org.eclipse.emf.ecore.xmi.impl.XMIHandler.startElement(XMIHandler.java:163)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:506)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1367)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2768)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:846)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:775)
	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:123)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1210)
	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:628)
	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:332)
	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:175)
	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:240)
	at org.eclipse.acceleo.model.mtl.resource.EMtlResourceImpl.doLoad(EMtlResourceImpl.java:93)
	at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1505)
	at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1284)
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoad(ResourceSetImpl.java:259)
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:274)
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResource(ResourceSetImpl.java:406)
	at org.eclipse.acceleo.common.utils.ModelUtils.load(ModelUtils.java:361)
	at org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator.initialize(AbstractAcceleoGenerator.java:385)
....


I attached parent pom.xml and pom.xml file of Acceleo-based generator.

Could anyone,please, tell me what can be the reason?
Or, maybe, someone has an example of Acceleo generator that was built with maven and that works on Obeo Designer 6.2?

Thanks in advance,
Mary
  • Attachment: ParentPom.xml
    (Size: 4.25KB, Downloaded 158 times)
  • Attachment: ChildPom.xml
    (Size: 1.49KB, Downloaded 88 times)
Re: [Acceleo] An Acceleo-based generator built with Maven does not work on Obeo Designer 6.2 [message #1441237 is a reply to message #1441209] Thu, 09 October 2014 12:38 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 5834
Registered: July 2009
Senior Member
Hi

THe debugger is your friend.

When you get an exception such as java.lang.StringIndexOutOfBoundsException
find out what the string was/wasn't where it did/didn't come from and
why the index is rubbush.

Usually you will find an unresolved proxy is involved.

Regards

Ed Willink


On 09/10/2014 12:53, Mary P. wrote:
> Hello,
> I have a graphical editor created with Obeo Designer and an Acceleo-based generator that generates text files from UML classes.
> When I debug my application locally from Obeo, everything works fine.
>
> But if I build my application using Maven and then install it on Obeo Designer as a plugin, then, whenever I try to generate a text file using my Acceleo-based generator, I get the following exception:
>
>
> java.lang.StringIndexOutOfBoundsException: String index out of range: -1
> at java.lang.String.substring(String.java:1911)
> at org.eclipse.emf.ecore.impl.EModelElementImpl.eObjectForURIFragmentSegment(EModelElementImpl.java:417)
> at org.eclipse.emf.ecore.resource.impl.ResourceImpl.getEObject(ResourceImpl.java:774)
> at org.eclipse.emf.ecore.resource.impl.ResourceImpl.getEObject(ResourceImpl.java:750)
> at org.eclipse.emf.ecore.xmi.impl.XMLHandler.setValueFromId(XMLHandler.java:2811)
> at org.eclipse.emf.ecore.xmi.impl.XMLHandler.setAttribValue(XMLHandler.java:2716)
> at org.eclipse.emf.ecore.xmi.impl.SAXXMIHandler.handleObjectAttribs(SAXXMIHandler.java:79)
> at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectFromFactory(XMLHandler.java:2188)
> at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectFromFeatureType(XMLHandler.java:2154)
> at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObject(XMLHandler.java:2030)
> at org.eclipse.emf.ecore.xmi.impl.XMIHandler.createObject(XMIHandler.java:128)
> at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleFeature(XMLHandler.java:1809)
> at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:1018)
> at org.eclipse.emf.ecore.xmi.impl.XMIHandler.processElement(XMIHandler.java:81)
> at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:996)
> at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:707)
> at org.eclipse.emf.ecore.xmi.impl.XMIHandler.startElement(XMIHandler.java:163)
> at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:506)
> at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1367)
> at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2768)
> at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
> at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
> at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:846)
> at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:775)
> at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:123)
> at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1210)
> at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:628)
> at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:332)
> at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:175)
> at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:240)
> at org.eclipse.acceleo.model.mtl.resource.EMtlResourceImpl.doLoad(EMtlResourceImpl.java:93)
> at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1505)
> at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1284)
> at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoad(ResourceSetImpl.java:259)
> at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:274)
> at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResource(ResourceSetImpl.java:406)
> at org.eclipse.acceleo.common.utils.ModelUtils.load(ModelUtils.java:361)
> at org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator.initialize(AbstractAcceleoGenerator.java:385)
> ...
>
>
> I attached parent pom.xml and pom.xml file of Acceleo-based generator.
>
> Could anyone,please, tell me what can be the reason?
> Or, maybe, someone has an example of Acceleo generator that was built with maven and that works on Obeo Designer 6.2?
>
> Thanks in advance,
> Mary
>
Re: [Acceleo] An Acceleo-based generator built with Maven does not work on Obeo Designer 6.2 [message #1443935 is a reply to message #1441237] Mon, 13 October 2014 12:28 Go to previous messageGo to next message
Mary P. is currently offline Mary P.Friend
Messages: 48
Registered: November 2012
Member
Hello,
Thank you for the reply!

Using the debugger I found out that the exception occurs when my .emtl file is parsed.
When EModelElementImpl executes the following code of the method eObjectForURIFragmentSegment(String uriFragmentSegment)

      int index = uriFragmentSegment.lastIndexOf("%");
      boolean hasCount = false;
      if (index == length - 1 || (hasCount = uriFragmentSegment.charAt(index + 1) == '.'))
          {
            // Decode all encoded characters.
            //
            String source = URI.decode(uriFragmentSegment.substring(1, index));
            
            // Check for a count, i.e., a '.' followed by a number.
       .......


where uriFragmentSegment is equal to "%". It fails on uriFragmentSegment.substring(1, index)).... that makes sense.

But what can I do in order to avoid this issue?

"%" appears in my .emtl file in the following section:

<eAnnotations source="positions.1" references="/0/generateInterface/%">
<details key="start" value="193"/>
<details key="end" value="237"/>
<details key="line" value="6"/>
</eAnnotations>


where generateInterface is the name of my template

Thanks in advance

Best regards,
Mary

[Updated on: Mon, 13 October 2014 13:28]

Report message to a moderator

Re: [Acceleo] An Acceleo-based generator built with Maven does not work on Obeo Designer 6.2 [message #1444544 is a reply to message #1443935] Tue, 14 October 2014 08:01 Go to previous message
Mary P. is currently offline Mary P.Friend
Messages: 48
Registered: November 2012
Member
Hello,
I think now that my issue may be similar to this one:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=421341

Here, they say that an Acceleo generator built with EMF 2.9+ cannot be executed on earlier versions of EMF.

Hence, my new question is: how can I say explicitly in Maven, which version of EMF should be used for Acceleo build?
Or, maybe, I missed something...?

Thanks in advance

Best regards,
Mary
Previous Topic:[Acceleo] Sirius Model transformation problem
Next Topic:[Acceleo] Generation of code and creation of sub-unit problems
Goto Forum:
  


Current Time: Thu Apr 19 18:00:46 GMT 2018

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

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