phdmohans / odata4j

Automatically exported from code.google.com/p/odata4j
0 stars 0 forks source link

getNavProperty for In-Memory producer should throw NotFoundException in case of empty collection #260

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. I have a metamodel where Class has a Parent, which is another Class.
<NavigationProperty Name="Parent" Relationship="pdmdr.FK_Class_Class" 
FromRole="Class" ToRole="Class1"></NavigationProperty>

2. I'm using an InMemoryProducer, and a POJO with the corresponding getter
public OMetaClass getParent() { return parent; }

3. I'm trying to retrieve a Class Parent, for which Parent is null.

What is the expected output? What do you see instead?
I get a java.lang.NullPointerException.
I was expecting a org.odata4j.exceptions.NotFoundException.

What version of the product are you using? On what operating system?
I'm using odata4j-core-0.7.0, with Eclipse for EE 3.7 32-bit, on Windows 7 
64-bit.

Please provide any additional information below.
From the comment of getNavProperty "a single Entity (can be null)", it seems 
that case was supposed to work.
But I get the NPE in toOEntity, on the call to obj.getClass() with a null obj.

Original issue reported on code.google.com by pmen...@gmail.com on 14 Jun 2013 at 10:40