Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Feature Map Changes -> NPE
Feature Map Changes -> NPE [message #419779] Fri, 06 June 2008 21:41 Go to next message
Miles Parker is currently offline Miles ParkerFriend
Messages: 1341
Registered: July 2009
Senior Member
Ed et. al.,

I have an NPE issue that hs shown up under 2.4.0.v200805270202 (RC2
Bundle) but doesn't occur under 2.4.0.v200805052017 and earlier. I'm
guessing this is related to something that I've implemented incorrectly
and is finally biting me. In brief, I have an implementation of the
delgated item provider in the book, where directly contained memebers
are grouped together under a tranisient item provider.

Before laying a bug out there, I thought I'd check and see if this
might be the likely case where I've implemnted something incorrectly or
am using a seprecated approach. The error is:

java.lang.NullPointerException
at
org.eclipse.emf.ecore.util.FeatureMapUtil.isFeatureMap(Featu reMapUtil.java:150)
at

org.eclipse.emf.edit.provider.ItemProviderAdapter.getCreateC hildDescription(ItemProviderAdapter.java:1690)
at

org.eclipse.emf.edit.command.CreateChildCommand.getDescripti on(CreateChildCommand.java:326)
at

org.eclipse.emf.edit.ui.action.StaticSelectionCommandAction. configureAction(StaticSelectionCommandAction.java:194)
at

org.eclipse.emf.edit.ui.action.CreateChildAction.<init>(CreateChildAction.java:53)
at

org.eclipse.emf.edit.ui.action.CreateChildAction.<init>(CreateChildAction.java:63)
at

org.metaabm.ide.MetaABMEditorActionBarContributor.generateCr eateChildActions(MetaABMEditorActionBarContributor.java:420)
at

org.metaabm.ide.MetaABMEditorActionBarContributor.selectionC hanged(MetaABMEditorActionBarContributor.java:371)
at

org.metaabm.ide.MetaABMEditor.setSelection(MetaABMEditor.jav a:1736)
at org.metaabm.ide.MetaABMEditor$8.selectionChanged(MetaABMEdit or.java:856)


The most relevant change I've been able to find is:


685
     }
     }
1686
 
 
1687
     Object sibling = selectionObject;
     Object sibling = selectionObject;
1688
     Object siblingFeature = getChildFeature(owner, sibling);
     EStructuralFeature siblingFeature = getChildFeature(owner, sibling);
1689
 
 
1690
     if (siblingFeature instanceof EStructuralFeature &&
FeatureMapUtil.isFeatureMap((EStructuralFeature)siblingFeatu re))
     if (FeatureMapUtil.isFeatureMap(siblingFeature))
1691
     {
     {
1692
       FeatureMap.Entry entry = (FeatureMap.Entry)sibling;
       FeatureMap.Entry entry = (FeatureMap.Entry)sibling;
1693
       siblingFeature = entry.getEStructuralFeature();
       siblingFeature = entry.getEStructuralFeature();

Let me know if you need more info.
Re: Feature Map Changes -> NPE [message #419781 is a reply to message #419779] Fri, 06 June 2008 23:10 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Miles,

Comments below.


Miles Parker wrote:
> Ed et. al.,
>
> I have an NPE issue that hs shown up under 2.4.0.v200805270202 (RC2
> Bundle) but doesn't occur under 2.4.0.v200805052017 and earlier. I'm
> guessing this is related to something that I've implemented
> incorrectly and is finally biting me. In brief, I have an
> implementation of the delgated item provider in the book, where
> directly contained memebers are grouped together under a tranisient
> item provider.
>
> Before laying a bug out there, I thought I'd check and see if this
> might be the likely case where I've implemnted something incorrectly
> or am using a seprecated approach. The error is:
>
> java.lang.NullPointerException
> at
> org.eclipse.emf.ecore.util.FeatureMapUtil.isFeatureMap(Featu reMapUtil.java:150)
>
> at
> org.eclipse.emf.edit.provider.ItemProviderAdapter.getCreateC hildDescription(ItemProviderAdapter.java:1690)
>
> at
> org.eclipse.emf.edit.command.CreateChildCommand.getDescripti on(CreateChildCommand.java:326)
>
> at
> org.eclipse.emf.edit.ui.action.StaticSelectionCommandAction. configureAction(StaticSelectionCommandAction.java:194)
>
> at
> org.eclipse.emf.edit.ui.action.CreateChildAction.<init>(CreateChildAction.java:53)
>
> at
> org.eclipse.emf.edit.ui.action.CreateChildAction.<init>(CreateChildAction.java:63)
>
> at
> org.metaabm.ide.MetaABMEditorActionBarContributor.generateCr eateChildActions(MetaABMEditorActionBarContributor.java:420)
>
> at
> org.metaabm.ide.MetaABMEditorActionBarContributor.selectionC hanged(MetaABMEditorActionBarContributor.java:371)
>
> at
> org.metaabm.ide.MetaABMEditor.setSelection(MetaABMEditor.jav a:1736)
> at
> org.metaabm.ide.MetaABMEditor$8.selectionChanged(MetaABMEdit or.java:856)
>
>
> The most relevant change I've been able to find is:
>
>
> 685
> }
> }
> 1686
>
>
> 1687
> Object sibling = selectionObject;
> Object sibling = selectionObject;
> 1688
> Object siblingFeature = getChildFeature(owner, sibling);
> EStructuralFeature siblingFeature = getChildFeature(owner, sibling);
> 1689
>
>
> 1690
> if (siblingFeature instanceof EStructuralFeature &&
> FeatureMapUtil.isFeatureMap((EStructuralFeature)siblingFeatu re))
I suppose this acted as a null guard before; something I hadn't
considered. We should add the null guard in to do this properly.
Please open a bugzilla and I'll do that.
> if (FeatureMapUtil.isFeatureMap(siblingFeature))
> 1691
> {
> {
> 1692
> FeatureMap.Entry entry = (FeatureMap.Entry)sibling;
> FeatureMap.Entry entry = (FeatureMap.Entry)sibling;
> 1693
> siblingFeature = entry.getEStructuralFeature();
> siblingFeature = entry.getEStructuralFeature();
>
> Let me know if you need more info.
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Feature Map Changes -> NPE [message #419808 is a reply to message #419781] Sat, 07 June 2008 05:41 Go to previous messageGo to next message
Miles Parker is currently offline Miles ParkerFriend
Messages: 1341
Registered: July 2009
Senior Member
Done. Can you think of any Q&D work-arounds? I tried returning a new
EAttribute, but that jsut broke a little further downstream..

On 2008-06-06 16:10:05 -0700, Ed Merks <merks@ca.ibm.com> said:

> Miles,
>
> Comments below.
>
>
> Miles Parker wrote:
>> Ed et. al.,
>>
>> I have an NPE issue that hs shown up under 2.4.0.v200805270202 (RC2
>> Bundle) but doesn't occur under 2.4.0.v200805052017 and earlier. I'm
>> guessing this is related to something that I've implemented incorrectly
>> and is finally biting me. In brief, I have an implementation of the
>> delgated item provider in the book, where directly contained memebers
>> are grouped together under a tranisient item provider.
>>
>> Before laying a bug out there, I thought I'd check and see if this
>> might be the likely case where I've implemnted something incorrectly or
>> am using a seprecated approach. The error is:
>>
>> java.lang.NullPointerException
>> at
>> org.eclipse.emf.ecore.util.FeatureMapUtil.isFeatureMap(Featu reMapUtil.java:150)
at
org.eclipse.emf.edit.provider.ItemProviderAdapter.getCreateC hildDescription(ItemProviderAdapter.java:1690)
at
org.eclipse.emf.edit.command.CreateChildCommand.getDescripti on(CreateChildCommand.java:326)
at
org.eclipse.emf.edit.ui.action.StaticSelectionCommandAction. configureAction(StaticSelectionCommandAction.java:194)
at
org.eclipse.emf.edit.ui.action.CreateChildAction.<init>(CreateChildAction.java:53)
at
org.eclipse.emf.edit.ui.action.CreateChildAction.<init>(CreateChildAction.java:63)
at
org.metaabm.ide.MetaABMEditorActionBarContributor.generateCr eateChildActions(MetaABMEditorActionBarContributor.java:420)
at
org.metaabm.ide.MetaABMEditorActionBarContributor.selectionC hanged(MetaABMEditorActionBarContributor.java:371)
at
org.metaabm.ide.MetaABMEditor.setSelection(MetaABMEditor.jav a:1736)
at
>>
>> org.metaabm.ide.MetaABMEditor$8.selectionChanged(MetaABMEdit or.java:856)
>>
>>
>> The most relevant change I've been able to find is:
>>
>>
>> 685
>> }
>> }
>> 1686
>> 1687
>> Object sibling = selectionObject;
>> Object sibling = selectionObject;
>> 1688
>> Object siblingFeature = getChildFeature(owner, sibling);
>> EStructuralFeature siblingFeature = getChildFeature(owner, sibling);
>> 1689
>> 1690
>> if (siblingFeature instanceof EStructuralFeature &&
>> FeatureMapUtil.isFeatureMap((EStructuralFeature)siblingFeatu re))
> I suppose this acted as a null guard before; something I hadn't
> considered. We should add the null guard in to do this properly.
> Please open a bugzilla and I'll do that.
>> if (FeatureMapUtil.isFeatureMap(siblingFeature))
>> 1691
>> {
>> {
>> 1692
>> FeatureMap.Entry entry = (FeatureMap.Entry)sibling;
>> FeatureMap.Entry entry = (FeatureMap.Entry)sibling;
>> 1693
>> siblingFeature = entry.getEStructuralFeature();
>> siblingFeature = entry.getEStructuralFeature();
>>
>> Let me know if you need more info.
Re: Feature Map Changes -> NPE [message #419810 is a reply to message #419808] Sat, 07 June 2008 11:01 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Miles,

I attached the fixed .class to the bugzilla so you could patch the
jar. Returning a new EReference should work better...


Miles Parker wrote:
>
> Done. Can you think of any Q&D work-arounds? I tried returning a new
> EAttribute, but that jsut broke a little further downstream..
>
> On 2008-06-06 16:10:05 -0700, Ed Merks <merks@ca.ibm.com> said:
>
>> Miles,
>>
>> Comments below.
>>
>>
>> Miles Parker wrote:
>>> Ed et. al.,
>>>
>>> I have an NPE issue that hs shown up under 2.4.0.v200805270202 (RC2
>>> Bundle) but doesn't occur under 2.4.0.v200805052017 and earlier.
>>> I'm guessing this is related to something that I've implemented
>>> incorrectly and is finally biting me. In brief, I have an
>>> implementation of the delgated item provider in the book, where
>>> directly contained memebers are grouped together under a tranisient
>>> item provider.
>>>
>>> Before laying a bug out there, I thought I'd check and see if this
>>> might be the likely case where I've implemnted something incorrectly
>>> or am using a seprecated approach. The error is:
>>>
>>> java.lang.NullPointerException
>>> at
>>> org.eclipse.emf.ecore.util.FeatureMapUtil.isFeatureMap(Featu reMapUtil.java:150)
>>>
> at
> org.eclipse.emf.edit.provider.ItemProviderAdapter.getCreateC hildDescription(ItemProviderAdapter.java:1690)
>
> at
> org.eclipse.emf.edit.command.CreateChildCommand.getDescripti on(CreateChildCommand.java:326)
>
> at
> org.eclipse.emf.edit.ui.action.StaticSelectionCommandAction. configureAction(StaticSelectionCommandAction.java:194)
>
> at
> org.eclipse.emf.edit.ui.action.CreateChildAction.<init>(CreateChildAction.java:53)
>
> at
> org.eclipse.emf.edit.ui.action.CreateChildAction.<init>(CreateChildAction.java:63)
>
> at
> org.metaabm.ide.MetaABMEditorActionBarContributor.generateCr eateChildActions(MetaABMEditorActionBarContributor.java:420)
>
> at
> org.metaabm.ide.MetaABMEditorActionBarContributor.selectionC hanged(MetaABMEditorActionBarContributor.java:371)
>
> at
> org.metaabm.ide.MetaABMEditor.setSelection(MetaABMEditor.jav a:1736)
> at
>>>
>>> org.metaabm.ide.MetaABMEditor$8.selectionChanged(MetaABMEdit or.java:856)
>>>
>>>
>>>
>>> The most relevant change I've been able to find is:
>>>
>>>
>>> 685
>>> }
>>> }
>>> 1686
>>> 1687
>>> Object sibling = selectionObject;
>>> Object sibling = selectionObject;
>>> 1688
>>> Object siblingFeature = getChildFeature(owner, sibling);
>>> EStructuralFeature siblingFeature = getChildFeature(owner,
>>> sibling);
>>> 1689
>>> 1690
>>> if (siblingFeature instanceof EStructuralFeature &&
>>> FeatureMapUtil.isFeatureMap((EStructuralFeature)siblingFeatu re))
>> I suppose this acted as a null guard before; something I hadn't
>> considered. We should add the null guard in to do this properly.
>> Please open a bugzilla and I'll do that.
>>> if (FeatureMapUtil.isFeatureMap(siblingFeature))
>>> 1691
>>> {
>>> {
>>> 1692
>>> FeatureMap.Entry entry = (FeatureMap.Entry)sibling;
>>> FeatureMap.Entry entry = (FeatureMap.Entry)sibling;
>>> 1693
>>> siblingFeature = entry.getEStructuralFeature();
>>> siblingFeature = entry.getEStructuralFeature();
>>>
>>> Let me know if you need more info.
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Feature Map Changes -> NPE [message #419816 is a reply to message #419810] Sat, 07 June 2008 19:05 Go to previous message
Miles Parker is currently offline Miles ParkerFriend
Messages: 1341
Registered: July 2009
Senior Member
On 2008-06-07 04:01:51 -0700, Ed Merks <merks@ca.ibm.com> said:

> Miles,
>
> I attached the fixed .class to the bugzilla so you could patch the jar.
> Returning a new EReference should work better...

Right. :) I just copied the old code into the relevant item provider..
Previous Topic:cannot open session to latest (CVS) CDO Server
Next Topic:[CDO]: simple usage scenario?
Goto Forum:
  


Current Time: Fri Apr 26 11:04:36 GMT 2024

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

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

Back to the top