Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [EMF Compare] ArrayIndexOutOfBoundsException in ResourceSimilarity#resourceURISimilarity()
[EMF Compare] ArrayIndexOutOfBoundsException in ResourceSimilarity#resourceURISimilarity() [message #499880] Tue, 24 November 2009 13:08 Go to next message
Eclipse UserFriend
Originally posted by: mail.andreasscharf.com

Hi,

I get an ArrayIndexOutOfBoundsException in
ResourceSimilarity#resourceURISimilartiy() line 146:

final String candidateName = candidate[candidate.length - 1];

Problem is the candidateArray is empty which results from the URI not
having any segments because it has the form #SOME_ELEMENT_ID which is
a relative ID.

Cheers,
Andreas
Re: [EMF Compare] ArrayIndexOutOfBoundsException in ResourceSimilarity#resourceURISimilarity() [message #499924 is a reply to message #499880] Tue, 24 November 2009 14:30 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------040804060909000906070400
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Hi,

Could you give me a little more information as to how you use the
comparison? I can't see a way to get to this code with empty URIs
containing only fragments.

laurent Goubet
Obeo

Andreas Scharf wrote:
> Hi,
>
> I get an ArrayIndexOutOfBoundsException in
> ResourceSimilarity#resourceURISimilartiy() line 146:
>
> final String candidateName = candidate[candidate.length - 1];
>
> Problem is the candidateArray is empty which results from the URI not
> having any segments because it has the form #SOME_ELEMENT_ID which is
> a relative ID.
>
> Cheers,
> Andreas


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

begin:vcard
fn:Laurent Goubet
n:Goubet;Laurent
org:<a href="http://www.obeo.fr">Obeo</a>
email;internet:laurent.goubet@obeo.fr
url:http://www.obeo.fr
version:2.1
end:vcard


--------------040804060909000906070400--
Re: [EMF Compare] ArrayIndexOutOfBoundsException in ResourceSimilarity#resourceURISimilarity() [message #499929 is a reply to message #499924] Tue, 24 November 2009 14:42 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mail.andreasscharf.com

Laurent,

the use case is a comparison of an UMLfile against a certain
(older/newer) revision. I have to mention that I'm not using the
CompareEditor which comes with EMF Compare but my own compare actions.

At some point in the XML there code like

<eClassifiers xmi:type="ecore:EClass"
xmi:id="SOME_ELEMENT_ID">
...
</eClassifiers>
<eClassifiers xmi:type="ecore:EClass"...>
<eSuperTypes href="#SOME_ELEMENT_ID"/>
</eClassifiers>

so the href points to an element relativ to the the elemen itself in
which case we only have a fragment and no segments.

If that isn't enough information I try to provide a small example since
I cannot share the original files.

Cheers,
Andreas

Laurent Goubet schrieb:
> Hi,
>
> Could you give me a little more information as to how you use the
> comparison? I can't see a way to get to this code with empty URIs
> containing only fragments.
>
> laurent Goubet
> Obeo
>
> Andreas Scharf wrote:
>> Hi,
>>
>> I get an ArrayIndexOutOfBoundsException in
>> ResourceSimilarity#resourceURISimilartiy() line 146:
>>
>> final String candidateName = candidate[candidate.length - 1];
>>
>> Problem is the candidateArray is empty which results from the URI not
>> having any segments because it has the form #SOME_ELEMENT_ID which is
>> a relative ID.
>>
>> Cheers,
>> Andreas
>
Re: [EMF Compare] ArrayIndexOutOfBoundsException in ResourceSimilarity#resourceURISimilarity() [message #499951 is a reply to message #499929] Tue, 24 November 2009 14:51 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Andreas,

By the time that href is loaded, it's typically resolved against the URI
of the containing resource. What URI do you use to load the resource
itself?


Andreas Scharf wrote:
> Laurent,
>
> the use case is a comparison of an UMLfile against a certain
> (older/newer) revision. I have to mention that I'm not using the
> CompareEditor which comes with EMF Compare but my own compare actions.
>
> At some point in the XML there code like
>
> <eClassifiers xmi:type="ecore:EClass"
> xmi:id="SOME_ELEMENT_ID">
> ...
> </eClassifiers>
> <eClassifiers xmi:type="ecore:EClass"...>
> <eSuperTypes href="#SOME_ELEMENT_ID"/>
> </eClassifiers>
>
> so the href points to an element relativ to the the elemen itself in
> which case we only have a fragment and no segments.
>
> If that isn't enough information I try to provide a small example since
> I cannot share the original files.
>
> Cheers,
> Andreas
>
> Laurent Goubet schrieb:
>> Hi,
>>
>> Could you give me a little more information as to how you use the
>> comparison? I can't see a way to get to this code with empty URIs
>> containing only fragments.
>>
>> laurent Goubet
>> Obeo
>>
>> Andreas Scharf wrote:
>>> Hi,
>>>
>>> I get an ArrayIndexOutOfBoundsException in
>>> ResourceSimilarity#resourceURISimilartiy() line 146:
>>>
>>> final String candidateName = candidate[candidate.length - 1];
>>>
>>> Problem is the candidateArray is empty which results from the URI
>>> not having any segments because it has the form #SOME_ELEMENT_ID
>>> which is
>>> a relative ID.
>>>
>>> Cheers,
>>> Andreas
>>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: [EMF Compare] ArrayIndexOutOfBoundsException in ResourceSimilarity#resourceURISimilarity() [message #499953 is a reply to message #499951] Tue, 24 November 2009 15:08 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------080607020707010603010105
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Andreas,

I'd also have thought that the URI would be fully resolved when reaching
this code, and have never seen (or reproduced for that matters) the NPE
you get. If you can share a small example with both the models you
compare and the action you use to compare, I'd like to try and reproduce
this; simply fixing the NPE wouldn't do the trick as I believe the same
assumptions are made at many places in my code.

Laurent Goubet
Obeo

Ed Merks wrote:
> Andreas,
>
> By the time that href is loaded, it's typically resolved against the URI
> of the containing resource. What URI do you use to load the resource
> itself?
>
>
> Andreas Scharf wrote:
>> Laurent,
>>
>> the use case is a comparison of an UMLfile against a certain
>> (older/newer) revision. I have to mention that I'm not using the
>> CompareEditor which comes with EMF Compare but my own compare actions.
>>
>> At some point in the XML there code like
>>
>> <eClassifiers xmi:type="ecore:EClass"
>> xmi:id="SOME_ELEMENT_ID">
>> ...
>> </eClassifiers>
>> <eClassifiers xmi:type="ecore:EClass"...>
>> <eSuperTypes href="#SOME_ELEMENT_ID"/>
>> </eClassifiers>
>>
>> so the href points to an element relativ to the the elemen itself in
>> which case we only have a fragment and no segments.
>>
>> If that isn't enough information I try to provide a small example since
>> I cannot share the original files.
>>
>> Cheers,
>> Andreas
>>
>> Laurent Goubet schrieb:
>>> Hi,
>>>
>>> Could you give me a little more information as to how you use the
>>> comparison? I can't see a way to get to this code with empty URIs
>>> containing only fragments.
>>>
>>> laurent Goubet
>>> Obeo
>>>
>>> Andreas Scharf wrote:
>>>> Hi,
>>>>
>>>> I get an ArrayIndexOutOfBoundsException in
>>>> ResourceSimilarity#resourceURISimilartiy() line 146:
>>>>
>>>> final String candidateName = candidate[candidate.length - 1];
>>>>
>>>> Problem is the candidateArray is empty which results from the URI
>>>> not having any segments because it has the form #SOME_ELEMENT_ID
>>>> which is
>>>> a relative ID.
>>>>
>>>> Cheers,
>>>> Andreas
>>>


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

begin:vcard
fn:Laurent Goubet
n:Goubet;Laurent
org:<a href="http://www.obeo.fr">Obeo</a>
email;internet:laurent.goubet@obeo.fr
url:http://www.obeo.fr
version:2.1
end:vcard


--------------080607020707010603010105--
Re: [EMF Compare] ArrayIndexOutOfBoundsException in ResourceSimilarity#resourceURISimilarity() [message #500299 is a reply to message #499953] Wed, 25 November 2009 15:50 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mail.andreasscharf.com

Hi,

I tried to reproduce the mentioned problem but I wasn't able to. But to
answer Ed's question:

I use the the following lines to load the remote version:

------8<-----------------------------------
EObject remoteModel =
ModelUtils.load(getFileContentOperation.getContent(),
finalRemote.getName(), new ResourceSetImpl());
------->8----------------------------------

where getFileContentOperation is a

org.eclipse.team.svn.core.operation.remote.GetFileContentOpe ration

and

#getContent()

returns an InputStream.

I noticed that the SubversiveTeamHandler in emf compare set a special
URI converter during resource loading: RevisionedURIConverter.

But as I mentioned above: I couldn't reproduce it.

Best regards,
Andreas


Laurent Goubet schrieb:
> Andreas,
>
> I'd also have thought that the URI would be fully resolved when reaching
> this code, and have never seen (or reproduced for that matters) the NPE
> you get. If you can share a small example with both the models you
> compare and the action you use to compare, I'd like to try and reproduce
> this; simply fixing the NPE wouldn't do the trick as I believe the same
> assumptions are made at many places in my code.
>
> Laurent Goubet
> Obeo
>
> Ed Merks wrote:
>> Andreas,
>>
>> By the time that href is loaded, it's typically resolved against the
>> URI of the containing resource. What URI do you use to load the
>> resource itself?
>>
>>
>> Andreas Scharf wrote:
>>> Laurent,
>>>
>>> the use case is a comparison of an UMLfile against a certain
>>> (older/newer) revision. I have to mention that I'm not using the
>>> CompareEditor which comes with EMF Compare but my own compare actions.
>>>
>>> At some point in the XML there code like
>>>
>>> <eClassifiers xmi:type="ecore:EClass"
>>> xmi:id="SOME_ELEMENT_ID">
>>> ...
>>> </eClassifiers>
>>> <eClassifiers xmi:type="ecore:EClass"...>
>>> <eSuperTypes href="#SOME_ELEMENT_ID"/>
>>> </eClassifiers>
>>>
>>> so the href points to an element relativ to the the elemen itself in
>>> which case we only have a fragment and no segments.
>>>
>>> If that isn't enough information I try to provide a small example since
>>> I cannot share the original files.
>>>
>>> Cheers,
>>> Andreas
>>>
>>> Laurent Goubet schrieb:
>>>> Hi,
>>>>
>>>> Could you give me a little more information as to how you use the
>>>> comparison? I can't see a way to get to this code with empty URIs
>>>> containing only fragments.
>>>>
>>>> laurent Goubet
>>>> Obeo
>>>>
>>>> Andreas Scharf wrote:
>>>>> Hi,
>>>>>
>>>>> I get an ArrayIndexOutOfBoundsException in
>>>>> ResourceSimilarity#resourceURISimilartiy() line 146:
>>>>>
>>>>> final String candidateName = candidate[candidate.length - 1];
>>>>>
>>>>> Problem is the candidateArray is empty which results from the URI
>>>>> not having any segments because it has the form #SOME_ELEMENT_ID
>>>>> which is
>>>>> a relative ID.
>>>>>
>>>>> Cheers,
>>>>> Andreas
>>>>
>
Re: [EMF Compare] ArrayIndexOutOfBoundsException in ResourceSimilarity#resourceURISimilarity() [message #500327 is a reply to message #500299] Wed, 25 November 2009 16:21 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.
--------------090305040801010600060505
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Andreas,

We use a custom URIConverter when loading SVN files so as to be able to
retrieve repository versions of models the currently loaded might depend
on. You'll notice though that we load the models the same way as you do
: SubversiveTeamHandler#loadResources() at line 90 for example sports code :
rightResource = ModelUtils.load(((ResourceElement)right).getContents(),
right.getName(), rightResourceSet).eResource();

I really can't figure out how you got that NPE in the first case :).

Laurent Goubet
Obeo

Andreas Scharf wrote:
> Hi,
>
> I tried to reproduce the mentioned problem but I wasn't able to. But to
> answer Ed's question:
>
> I use the the following lines to load the remote version:
>
> ------8<-----------------------------------
> EObject remoteModel =
> ModelUtils.load(getFileContentOperation.getContent(),
> finalRemote.getName(), new ResourceSetImpl());
> ------->8----------------------------------
>
> where getFileContentOperation is a
>
> org.eclipse.team.svn.core.operation.remote.GetFileContentOpe ration
>
> and
>
> #getContent()
>
> returns an InputStream.
>
> I noticed that the SubversiveTeamHandler in emf compare set a special
> URI converter during resource loading: RevisionedURIConverter.
>
> But as I mentioned above: I couldn't reproduce it.
>
> Best regards,
> Andreas
>
>
> Laurent Goubet schrieb:
>> Andreas,
>>
>> I'd also have thought that the URI would be fully resolved when
>> reaching this code, and have never seen (or reproduced for that
>> matters) the NPE you get. If you can share a small example with both
>> the models you compare and the action you use to compare, I'd like to
>> try and reproduce this; simply fixing the NPE wouldn't do the trick as
>> I believe the same assumptions are made at many places in my code.
>>
>> Laurent Goubet
>> Obeo
>>
>> Ed Merks wrote:
>>> Andreas,
>>>
>>> By the time that href is loaded, it's typically resolved against the
>>> URI of the containing resource. What URI do you use to load the
>>> resource itself?
>>>
>>>
>>> Andreas Scharf wrote:
>>>> Laurent,
>>>>
>>>> the use case is a comparison of an UMLfile against a certain
>>>> (older/newer) revision. I have to mention that I'm not using the
>>>> CompareEditor which comes with EMF Compare but my own compare actions.
>>>>
>>>> At some point in the XML there code like
>>>>
>>>> <eClassifiers xmi:type="ecore:EClass"
>>>> xmi:id="SOME_ELEMENT_ID">
>>>> ...
>>>> </eClassifiers>
>>>> <eClassifiers xmi:type="ecore:EClass"...>
>>>> <eSuperTypes href="#SOME_ELEMENT_ID"/>
>>>> </eClassifiers>
>>>>
>>>> so the href points to an element relativ to the the elemen itself in
>>>> which case we only have a fragment and no segments.
>>>>
>>>> If that isn't enough information I try to provide a small example since
>>>> I cannot share the original files.
>>>>
>>>> Cheers,
>>>> Andreas
>>>>
>>>> Laurent Goubet schrieb:
>>>>> Hi,
>>>>>
>>>>> Could you give me a little more information as to how you use the
>>>>> comparison? I can't see a way to get to this code with empty URIs
>>>>> containing only fragments.
>>>>>
>>>>> laurent Goubet
>>>>> Obeo
>>>>>
>>>>> Andreas Scharf wrote:
>>>>>> Hi,
>>>>>>
>>>>>> I get an ArrayIndexOutOfBoundsException in
>>>>>> ResourceSimilarity#resourceURISimilartiy() line 146:
>>>>>>
>>>>>> final String candidateName = candidate[candidate.length - 1];
>>>>>>
>>>>>> Problem is the candidateArray is empty which results from the URI
>>>>>> not having any segments because it has the form #SOME_ELEMENT_ID
>>>>>> which is
>>>>>> a relative ID.
>>>>>>
>>>>>> Cheers,
>>>>>> Andreas
>>>>>
>>


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

begin:vcard
fn:Laurent Goubet
n:Goubet;Laurent
org:<a href="http://www.obeo.fr">Obeo</a>
email;internet:laurent.goubet@obeo.fr
url:http://www.obeo.fr
version:2.1
end:vcard


--------------090305040801010600060505--
Previous Topic:Deserializing object based on complexType when elements are present in schema
Next Topic:the EMF Model interfaces can not be resolved.
Goto Forum:
  


Current Time: Fri Apr 26 14:29:34 GMT 2024

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

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

Back to the top