Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [EEF] NPE when selecting to add a relation
[EEF] NPE when selecting to add a relation [message #656855] Mon, 28 February 2011 19:16 Go to next message
Alain Picard is currently offline Alain PicardFriend
Messages: 266
Registered: July 2009
Senior Member
I am getting an NPE when selecting to add a relation

The stack trace is:
java.lang.NullPointerException at
org.eclipse.emf.eef.runtime.ui.widgets.settings.AdvancedEEFE ditorContentProvider.getElements(AdvancedEEFEditorContentPro vider.java:65)
org.eclipse.jface.viewers.StructuredViewer.getRawChildren(St ructuredViewer.java:989)
org.eclipse.jface.viewers.ColumnViewer.getRawChildren(Column Viewer.java:703)
org.eclipse.jface.viewers.AbstractTreeViewer.getRawChildren( AbstractTreeViewer.java:1332)
org.eclipse.jface.viewers.TreeViewer.getRawChildren(TreeView er.java:391)

which point to this line of code:
EList<Resource> resources =
((EEFEditorSettings)object).getSource().eResource().getResou rceSet().getResources();

and it happens because the getResourceSet() portion is returning null.

If I create at least one entry matching the relation the error goes away
and I see the dialog allowing me to select from the Model Resource or
All Resource.

Thanks
Alain
Re: [EEF] NPE when selecting to add a relation [message #657112 is a reply to message #656855] Tue, 01 March 2011 16:01 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33107
Registered: July 2009
Senior Member
Alain,

It's a little odd that you'd have a resource that isn't in a resource
set. How does that happen?


Alain Picard wrote:
> I am getting an NPE when selecting to add a relation
>
> The stack trace is:
> java.lang.NullPointerException at
> org.eclipse.emf.eef.runtime.ui.widgets.settings.AdvancedEEFE ditorContentProvider.getElements(AdvancedEEFEditorContentPro vider.java:65)
>
> org.eclipse.jface.viewers.StructuredViewer.getRawChildren(St ructuredViewer.java:989)
>
> org.eclipse.jface.viewers.ColumnViewer.getRawChildren(Column Viewer.java:703)
>
> org.eclipse.jface.viewers.AbstractTreeViewer.getRawChildren( AbstractTreeViewer.java:1332)
>
> org.eclipse.jface.viewers.TreeViewer.getRawChildren(TreeView er.java:391)
>
> which point to this line of code:
> EList<Resource> resources =
> ((EEFEditorSettings)object).getSource().eResource().getResou rceSet().getResources();
>
>
> and it happens because the getResourceSet() portion is returning null.
>
> If I create at least one entry matching the relation the error goes
> away and I see the dialog allowing me to select from the Model
> Resource or All Resource.
>
> Thanks
> Alain


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: [EEF] NPE when selecting to add a relation [message #657183 is a reply to message #657112] Tue, 01 March 2011 20:54 Go to previous messageGo to next message
Alain Picard is currently offline Alain PicardFriend
Messages: 266
Registered: July 2009
Senior Member
On 3/1/2011 11:01 AM, Ed Merks wrote:
> Alain,
>
> It's a little odd that you'd have a resource that isn't in a resource
> set. How does that happen?

Not sure but it does. :)

Alain

>
>
> Alain Picard wrote:
>> I am getting an NPE when selecting to add a relation
>>
>> The stack trace is:
>> java.lang.NullPointerException at
>> org.eclipse.emf.eef.runtime.ui.widgets.settings.AdvancedEEFE ditorContentProvider.getElements(AdvancedEEFEditorContentPro vider.java:65)
>>
>> org.eclipse.jface.viewers.StructuredViewer.getRawChildren(St ructuredViewer.java:989)
>>
>> org.eclipse.jface.viewers.ColumnViewer.getRawChildren(Column Viewer.java:703)
>>
>> org.eclipse.jface.viewers.AbstractTreeViewer.getRawChildren( AbstractTreeViewer.java:1332)
>>
>> org.eclipse.jface.viewers.TreeViewer.getRawChildren(TreeView er.java:391)
>>
>> which point to this line of code:
>> EList<Resource> resources =
>> ((EEFEditorSettings)object).getSource().eResource().getResou rceSet().getResources();
>>
>>
>> and it happens because the getResourceSet() portion is returning null.
>>
>> If I create at least one entry matching the relation the error goes
>> away and I see the dialog allowing me to select from the Model
>> Resource or All Resource.
>>
>> Thanks
>> Alain
Re: [EEF] NPE when selecting to add a relation [message #657201 is a reply to message #657183] Tue, 01 March 2011 22:35 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33107
Registered: July 2009
Senior Member
Alain,

I imagine they'll likely need a test case for this if you want to report
it as a bug. In the mean time, you could determine the URI of that
resource, who's creating a resource URI, and why it's not created as
part of a resource set. It's quite unusual to have "free floating"
resources...


Alain Picard wrote:
> On 3/1/2011 11:01 AM, Ed Merks wrote:
>> Alain,
>>
>> It's a little odd that you'd have a resource that isn't in a resource
>> set. How does that happen?
>
> Not sure but it does. :)
>
> Alain
>
>>
>>
>> Alain Picard wrote:
>>> I am getting an NPE when selecting to add a relation
>>>
>>> The stack trace is:
>>> java.lang.NullPointerException at
>>> org.eclipse.emf.eef.runtime.ui.widgets.settings.AdvancedEEFE ditorContentProvider.getElements(AdvancedEEFEditorContentPro vider.java:65)
>>>
>>>
>>> org.eclipse.jface.viewers.StructuredViewer.getRawChildren(St ructuredViewer.java:989)
>>>
>>>
>>> org.eclipse.jface.viewers.ColumnViewer.getRawChildren(Column Viewer.java:703)
>>>
>>>
>>> org.eclipse.jface.viewers.AbstractTreeViewer.getRawChildren( AbstractTreeViewer.java:1332)
>>>
>>>
>>> org.eclipse.jface.viewers.TreeViewer.getRawChildren(TreeView er.java:391)
>>>
>>>
>>> which point to this line of code:
>>> EList<Resource> resources =
>>> ((EEFEditorSettings)object).getSource().eResource().getResou rceSet().getResources();
>>>
>>>
>>>
>>> and it happens because the getResourceSet() portion is returning null.
>>>
>>> If I create at least one entry matching the relation the error goes
>>> away and I see the dialog allowing me to select from the Model
>>> Resource or All Resource.
>>>
>>> Thanks
>>> Alain
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: [EEF] NPE when selecting to add a relation [message #657224 is a reply to message #657201] Wed, 02 March 2011 01:37 Go to previous messageGo to next message
Alain Picard is currently offline Alain PicardFriend
Messages: 266
Registered: July 2009
Senior Member
On 3/1/2011 5:35 PM, Ed Merks wrote:
Ed,

The example is a simple modification of the model1.ecore from CDO again,
just with the offending Map$Entry removed.

I just found a very interesting thing. In
org.eclipse.emf.eef.runtime.ui.widgets.settings.AdvancedEEFE ditorContentProvider.getElements
we have:

public Object[] getElements(Object object) {
if (object instanceof EEFEditorSettings) {
EList<Resource> resources =
((EEFEditorSettings)object).getSource().eResource().getResou rceSet().getResources();
resources.retainAll(this.choiceOfValues);
return resources.toArray();
}
return super.getElements(object);
}
what happens is that if I click the + button on a widget implemented
with AdvancedReferencesTable when there is no reference content that
exist, the getElements() method is called a first time and there is no
error, but resources is set to an empty list. Then when it calls
resources.retainAll with an empty choice a values, the retainAll ends up
calling remove, which calls inverseRemove which ends with:
return resource.basicSetResourceSet(null, notifications); resetting the
Resourceset value to null.

Then on the following calls, the resourceset is null and voila, an NPE.

HTH,

Alain


> Alain,
>
> I imagine they'll likely need a test case for this if you want to report
> it as a bug. In the mean time, you could determine the URI of that
> resource, who's creating a resource URI, and why it's not created as
> part of a resource set. It's quite unusual to have "free floating"
> resources...




>
>
> Alain Picard wrote:
>> On 3/1/2011 11:01 AM, Ed Merks wrote:
>>> Alain,
>>>
>>> It's a little odd that you'd have a resource that isn't in a resource
>>> set. How does that happen?
>>
>> Not sure but it does. :)
>>
>> Alain
>>
>>>
>>>
>>> Alain Picard wrote:
>>>> I am getting an NPE when selecting to add a relation
>>>>
>>>> The stack trace is:
>>>> java.lang.NullPointerException at
>>>> org.eclipse.emf.eef.runtime.ui.widgets.settings.AdvancedEEFE ditorContentProvider.getElements(AdvancedEEFEditorContentPro vider.java:65)
>>>>
>>>>
>>>> org.eclipse.jface.viewers.StructuredViewer.getRawChildren(St ructuredViewer.java:989)
>>>>
>>>>
>>>> org.eclipse.jface.viewers.ColumnViewer.getRawChildren(Column Viewer.java:703)
>>>>
>>>>
>>>> org.eclipse.jface.viewers.AbstractTreeViewer.getRawChildren( AbstractTreeViewer.java:1332)
>>>>
>>>>
>>>> org.eclipse.jface.viewers.TreeViewer.getRawChildren(TreeView er.java:391)
>>>>
>>>>
>>>> which point to this line of code:
>>>> EList<Resource> resources =
>>>> ((EEFEditorSettings)object).getSource().eResource().getResou rceSet().getResources();
>>>>
>>>>
>>>>
>>>> and it happens because the getResourceSet() portion is returning null.
>>>>
>>>> If I create at least one entry matching the relation the error goes
>>>> away and I see the dialog allowing me to select from the Model
>>>> Resource or All Resource.
>>>>
>>>> Thanks
>>>> Alain
>>
Re: [EEF] NPE when selecting to add a relation [message #657234 is a reply to message #657224] Wed, 02 March 2011 03:59 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33107
Registered: July 2009
Senior Member
Alain,

Comments below.

Alain Picard wrote:
> On 3/1/2011 5:35 PM, Ed Merks wrote:
> Ed,
>
> The example is a simple modification of the model1.ecore from CDO
> again, just with the offending Map$Entry removed.
>
> I just found a very interesting thing. In
> org.eclipse.emf.eef.runtime.ui.widgets.settings.AdvancedEEFE ditorContentProvider.getElements
> we have:
>
> public Object[] getElements(Object object) {
> if (object instanceof EEFEditorSettings) {
> EList<Resource> resources =
> ((EEFEditorSettings)object).getSource().eResource().getResou rceSet().getResources();
>
> resources.retainAll(this.choiceOfValues);
Modifying the resource set itself as part of producing a view for it
seems totally bad! This code should make a copy of the list of resources...
> return resources.toArray();
> }
> return super.getElements(object);
> }
> what happens is that if I click the + button on a widget implemented
> with AdvancedReferencesTable when there is no reference content that
> exist, the getElements() method is called a first time and there is no
> error, but resources is set to an empty list. Then when it calls
> resources.retainAll with an empty choice a values, the retainAll ends
> up calling remove, which calls inverseRemove which ends with:
> return resource.basicSetResourceSet(null, notifications); resetting
> the Resourceset value to null.
>
> Then on the following calls, the resourceset is null and voila, an NPE.
>
> HTH,
>
> Alain
>
>
>> Alain,
>>
>> I imagine they'll likely need a test case for this if you want to report
>> it as a bug. In the mean time, you could determine the URI of that
>> resource, who's creating a resource URI, and why it's not created as
>> part of a resource set. It's quite unusual to have "free floating"
>> resources...
>
>
>
>
>>
>>
>> Alain Picard wrote:
>>> On 3/1/2011 11:01 AM, Ed Merks wrote:
>>>> Alain,
>>>>
>>>> It's a little odd that you'd have a resource that isn't in a resource
>>>> set. How does that happen?
>>>
>>> Not sure but it does. :)
>>>
>>> Alain
>>>
>>>>
>>>>
>>>> Alain Picard wrote:
>>>>> I am getting an NPE when selecting to add a relation
>>>>>
>>>>> The stack trace is:
>>>>> java.lang.NullPointerException at
>>>>> org.eclipse.emf.eef.runtime.ui.widgets.settings.AdvancedEEFE ditorContentProvider.getElements(AdvancedEEFEditorContentPro vider.java:65)
>>>>>
>>>>>
>>>>>
>>>>> org.eclipse.jface.viewers.StructuredViewer.getRawChildren(St ructuredViewer.java:989)
>>>>>
>>>>>
>>>>>
>>>>> org.eclipse.jface.viewers.ColumnViewer.getRawChildren(Column Viewer.java:703)
>>>>>
>>>>>
>>>>>
>>>>> org.eclipse.jface.viewers.AbstractTreeViewer.getRawChildren( AbstractTreeViewer.java:1332)
>>>>>
>>>>>
>>>>>
>>>>> org.eclipse.jface.viewers.TreeViewer.getRawChildren(TreeView er.java:391)
>>>>>
>>>>>
>>>>>
>>>>> which point to this line of code:
>>>>> EList<Resource> resources =
>>>>> ((EEFEditorSettings)object).getSource().eResource().getResou rceSet().getResources();
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> and it happens because the getResourceSet() portion is returning
>>>>> null.
>>>>>
>>>>> If I create at least one entry matching the relation the error goes
>>>>> away and I see the dialog allowing me to select from the Model
>>>>> Resource or All Resource.
>>>>>
>>>>> Thanks
>>>>> Alain
>>>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: [EEF] NPE when selecting to add a relation [message #658194 is a reply to message #657234] Mon, 07 March 2011 11:21 Go to previous message
Goulwen Le Fur is currently offline Goulwen Le FurFriend
Messages: 125
Registered: July 2009
Senior Member
Hello,

It's an important bug. I fix it in the next EEF 0.9 RC.

Thanks,

--
Goulwen Le Fur - goulwen.lefur@obeo.fr

Le 02/03/2011 04:59, Ed Merks a écrit :
> Alain,
>
> Comments below.
>
> Alain Picard wrote:
>> On 3/1/2011 5:35 PM, Ed Merks wrote:
>> Ed,
>>
>> The example is a simple modification of the model1.ecore from CDO
>> again, just with the offending Map$Entry removed.
>>
>> I just found a very interesting thing. In
>> org.eclipse.emf.eef.runtime.ui.widgets.settings.AdvancedEEFE ditorContentProvider.getElements
>> we have:
>>
>> public Object[] getElements(Object object) {
>> if (object instanceof EEFEditorSettings) {
>> EList<Resource> resources =
>> ((EEFEditorSettings)object).getSource().eResource().getResou rceSet().getResources();
>>
>> resources.retainAll(this.choiceOfValues);
> Modifying the resource set itself as part of producing a view for it
> seems totally bad! This code should make a copy of the list of resources...
>> return resources.toArray();
>> }
>> return super.getElements(object);
>> }
>> what happens is that if I click the + button on a widget implemented
>> with AdvancedReferencesTable when there is no reference content that
>> exist, the getElements() method is called a first time and there is no
>> error, but resources is set to an empty list. Then when it calls
>> resources.retainAll with an empty choice a values, the retainAll ends
>> up calling remove, which calls inverseRemove which ends with:
>> return resource.basicSetResourceSet(null, notifications); resetting
>> the Resourceset value to null.
>>
>> Then on the following calls, the resourceset is null and voila, an NPE.
>>
>> HTH,
>>
>> Alain
>>
>>
>>> Alain,
>>>
>>> I imagine they'll likely need a test case for this if you want to report
>>> it as a bug. In the mean time, you could determine the URI of that
>>> resource, who's creating a resource URI, and why it's not created as
>>> part of a resource set. It's quite unusual to have "free floating"
>>> resources...
>>
>>
>>
>>
>>>
>>>
>>> Alain Picard wrote:
>>>> On 3/1/2011 11:01 AM, Ed Merks wrote:
>>>>> Alain,
>>>>>
>>>>> It's a little odd that you'd have a resource that isn't in a resource
>>>>> set. How does that happen?
>>>>
>>>> Not sure but it does. :)
>>>>
>>>> Alain
>>>>
>>>>>
>>>>>
>>>>> Alain Picard wrote:
>>>>>> I am getting an NPE when selecting to add a relation
>>>>>>
>>>>>> The stack trace is:
>>>>>> java.lang.NullPointerException at
>>>>>> org.eclipse.emf.eef.runtime.ui.widgets.settings.AdvancedEEFE ditorContentProvider.getElements(AdvancedEEFEditorContentPro vider.java:65)
>>>>>>
>>>>>>
>>>>>>
>>>>>> org.eclipse.jface.viewers.StructuredViewer.getRawChildren(St ructuredViewer.java:989)
>>>>>>
>>>>>>
>>>>>>
>>>>>> org.eclipse.jface.viewers.ColumnViewer.getRawChildren(Column Viewer.java:703)
>>>>>>
>>>>>>
>>>>>>
>>>>>> org.eclipse.jface.viewers.AbstractTreeViewer.getRawChildren( AbstractTreeViewer.java:1332)
>>>>>>
>>>>>>
>>>>>>
>>>>>> org.eclipse.jface.viewers.TreeViewer.getRawChildren(TreeView er.java:391)
>>>>>>
>>>>>>
>>>>>>
>>>>>> which point to this line of code:
>>>>>> EList<Resource> resources =
>>>>>> ((EEFEditorSettings)object).getSource().eResource().getResou rceSet().getResources();
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> and it happens because the getResourceSet() portion is returning
>>>>>> null.
>>>>>>
>>>>>> If I create at least one entry matching the relation the error goes
>>>>>> away and I see the dialog allowing me to select from the Model
>>>>>> Resource or All Resource.
>>>>>>
>>>>>> Thanks
>>>>>> Alain
>>>>
>>
Previous Topic:Export code generator to Runnable-JAR file
Next Topic:[EEF] FeatureMap entry binary name
Goto Forum:
  


Current Time: Tue Mar 19 09:03:39 GMT 2024

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

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

Back to the top