Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [Compare] How to compare Java Packages
[Compare] How to compare Java Packages [message #521906] Fri, 19 March 2010 09:12 Go to next message
mRoby88 is currently offline mRoby88Friend
Messages: 4
Registered: March 2010
Junior Member
Dear All,
I'm developing an Eclipse Plug-in that needs to be able to compute the diff between Java Source files as well as Java Packages, as "Compare with Each other" Eclipse's functionality does.

Can EMF Compare help me? I installed in Eclipse all the materials as well as downloaded all the CVS projects via the *.psf file but I'm not able to use it as I want to.

I already take a look at the Stand-Alone project, as suggested in many threads, but it does not help since I reported errors while using it.

Loading resources.

org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Content is not allowed in prolog.
	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:201)
	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:180)
	at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1494)
	at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1282)
	at org.eclipse.emf.compare.util.ModelUtils.load(ModelUtils.java:320)
	at org.eclipse.emf.compare.util.ModelUtils.load(ModelUtils.java:218)
	at ExampleLauncher.main(ExampleLauncher.java:64)
Caused by: org.xml.sax.SAXParseException: Content is not allowed in prolog.
	at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
	at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:174)
	at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:388)
	at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1414)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:1039)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
	at javax.xml.parsers.SAXParser.parse(SAXParser.java:395)
	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:181)
	... 6 more



Can someone, please, provide me a snippet of code that can help me comparing two Java Packages?
How can I fix the error above?

The plug-in displays a pop-up menu when in the Package Explorer the user selects two resources.
- Comparing files is done using org.eclipse.compare
- Comparing Packages is not implemented so far.

Moreover, one of the two packages in the comparison has to be a remote version (SVN, CVS...) so, if I'm not wrong I should use a 3-way comparison.

I'd like to use EMF compare to do that. Seems interesting but I cannot manage to have it working.
The idea is to have the user to select two packages locally, at the beginning, and then compute the diff over all the classes belonging to that package.
Next step will be to select one package and let the plug-in took the other term of comparison from the repository.

Best regards and thank in advance,
Roberto M.
Re: [Compare] How to compare Java Packages [message #521913 is a reply to message #521906] Fri, 19 March 2010 09:33 Go to previous messageGo to next message
Cyril Jaquier is currently offline Cyril JaquierFriend
Messages: 80
Registered: July 2009
Member
Hi Roberto,

Comments below.

> Loading resources.
>
> org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Content is
> not allowed in prolog.
> at
> org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl. java:201)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLRes ourceImpl.java:180)
>
> at
> org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour ceImpl.java:1494)
>
> at
> org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour ceImpl.java:1282)
>
> at org.eclipse.emf.compare.util.ModelUtils.load(ModelUtils.java :320)
> at org.eclipse.emf.compare.util.ModelUtils.load(ModelUtils.java :218)
> at ExampleLauncher.main(ExampleLauncher.java:64)
> Caused by: org.xml.sax.SAXParseException: Content is not allowed in prolog.
> at
> com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper. createSAXParseException(ErrorHandlerWrapper.java:195)
>
> at
> com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper. fatalError(ErrorHandlerWrapper.java:174)
>
> at
> com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.rep ortError(XMLErrorReporter.java:388)
>
> at
> com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFat alError(XMLScanner.java:1414)
>
> at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerIm pl$PrologDriver.next(XMLDocumentScannerImpl.java:1039)
>
> at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerIm pl.next(XMLDocumentScannerImpl.java:648)
>
> at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS cannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java: 510)
>
> at
> com.sun.org.apache.xerces.internal.parsers.XML11Configuratio n.parse(XML11Configuration.java:807)
>
> at
> com.sun.org.apache.xerces.internal.parsers.XML11Configuratio n.parse(XML11Configuration.java:737)
>
> at
> com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(X MLParser.java:107)
>
> at
> com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser .parse(AbstractSAXParser.java:1205)
>
> at
> com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSA XParser.parse(SAXParserImpl.java:522)
>
> at javax.xml.parsers.SAXParser.parse(SAXParser.java:395)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl. java:181)
> ... 6 more
>
>
> Can someone, please, provide me a snippet of code that can help me
> comparing two Java Packages?
> How can I fix the error above?
>

That's exactly the stacktrace I got while trying to load a zipped
resource. Have a look at:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=306016

and the thread "Default options and Resource#load" in this newsgroup.

Regards,
Cyril
Re: [Compare] How to compare Java Packages [message #521921 is a reply to message #521913] Fri, 19 March 2010 10:05 Go to previous message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------030106080906090004080809
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Hi Roberto,

I must admit I don't really see what you're trying to do. EMF Compare is
meant to compare model files, not Java files (neither is it meant to
compare the java package which are directories).

You could use EMF Compare to compare java package if you created a Java
metamodel to represent Java information ... that would also require you
to create your own Java parser so as to store correct information in
this model about the files to compare... I doubt that's what you're
searching for.

Moreover, Eclipse already supports comparing Java packages (select two
packages => right click => select the menu "Compare with" => then the
item "Each Other"). What doesn't please you with this package comparison?

Laurent Goubet
Obeo

Cyril Jaquier wrote:
> Hi Roberto,
>
> Comments below.
>
>> Loading resources.
>>
>> org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Content is
>> not allowed in prolog.
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl. java:201)
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLRes ourceImpl.java:180)
>>
>> at
>> org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour ceImpl.java:1494)
>>
>> at
>> org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour ceImpl.java:1282)
>>
>> at org.eclipse.emf.compare.util.ModelUtils.load(ModelUtils.java :320)
>> at org.eclipse.emf.compare.util.ModelUtils.load(ModelUtils.java :218)
>> at ExampleLauncher.main(ExampleLauncher.java:64)
>> Caused by: org.xml.sax.SAXParseException: Content is not allowed in
>> prolog.
>> at
>> com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper. createSAXParseException(ErrorHandlerWrapper.java:195)
>>
>> at
>> com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper. fatalError(ErrorHandlerWrapper.java:174)
>>
>> at
>> com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.rep ortError(XMLErrorReporter.java:388)
>>
>> at
>> com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFat alError(XMLScanner.java:1414)
>>
>> at
>> com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerIm pl$PrologDriver.next(XMLDocumentScannerImpl.java:1039)
>>
>> at
>> com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerIm pl.next(XMLDocumentScannerImpl.java:648)
>>
>> at
>> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS cannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java: 510)
>>
>> at
>> com.sun.org.apache.xerces.internal.parsers.XML11Configuratio n.parse(XML11Configuration.java:807)
>>
>> at
>> com.sun.org.apache.xerces.internal.parsers.XML11Configuratio n.parse(XML11Configuration.java:737)
>>
>> at
>> com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(X MLParser.java:107)
>>
>> at
>> com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser .parse(AbstractSAXParser.java:1205)
>>
>> at
>> com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSA XParser.parse(SAXParserImpl.java:522)
>>
>> at javax.xml.parsers.SAXParser.parse(SAXParser.java:395)
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl. java:181)
>> ... 6 more
>>
>>
>> Can someone, please, provide me a snippet of code that can help me
>> comparing two Java Packages?
>> How can I fix the error above?
>>
>
> That's exactly the stacktrace I got while trying to load a zipped
> resource. Have a look at:
>
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=306016
>
> and the thread "Default options and Resource#load" in this newsgroup.
>
> Regards,
> Cyril


--------------030106080906090004080809
Content-Type: text/x-vcard; charset=utf-8;
name="laurent_goubet.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="laurent_goubet.vcf"

YmVnaW46dmNhcmQNCmZuOkxhdXJlbnQgR291YmV0DQpuOkdvdWJldDtMYXVy ZW50DQpvcmc6
PGEgaHJlZj0iaHR0cDovL3d3dy5vYmVvLmZyIj5PYmVvPC9hPg0KZW1haWw7 aW50ZXJuZXQ6
bGF1cmVudC5nb3ViZXRAb2Jlby5mcg0KdXJsOmh0dHA6Ly93d3cub2Jlby5m cg0KdmVyc2lv
bjoyLjENCmVuZDp2Y2FyZA0KDQo=
--------------030106080906090004080809--
Previous Topic:[EMF Plugin] Creating a model depending an other model
Next Topic:[CDO] Sample Project
Goto Forum:
  


Current Time: Fri Apr 19 19:22:35 GMT 2024

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

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

Back to the top