Simon Ammer created OLINGO-1167:
-----------------------------------
Summary: Pojogen fails when resource has same name as primitive
type
Key: OLINGO-1167
URL: https://issues.apache.org/jira/browse/OLINGO-1167
Project: Olingo
Issue Type: Bug
Components: odata4-commons, odata4-ext
Affects Versions: (Java) V4 4.3.0, (Java) V4 4.2.0
Environment: EntityType with same name as EdmPrimitiveTypeKind. For
instance: Binary
Reporter: Simon Ammer
Priority: Critical
At some parts Olingo does not use the fully qualified name of a resource to
reference it.Therefore _pojogen_ fails when you have a resource with the same
name as a value defined in
[EdmPrimitiveTypeKind.java|https://github.com/apache/olingo-odata4/blob/6bc17b668c16bbf96458c996bb9d9a768c74dc98/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmPrimitiveTypeKind.java].
Take the following scenario:
*$metadata*
{code:xml}
...
<EntityType Name="Binary">
<Property Name="asset" Type="Edm.Int64"/>
<Property Name="version" Type="Edm.Int64"/>
<Property Name="type" Type="Edm.String"/>
<Property Name="format" Type="Edm.String"/>
</EntityType>
...
{code}
My {{self.edu.Binary}} resource match with the primitive kind {{Edm.Binary}}
due to the check in
[EdmTypeInfo.java|https://github.com/apache/olingo-odata4/blob/4a51d16425144a7de0be0f9dcd01c667bed322df/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmTypeInfo.java#L107]:
{code:java}this.primitiveType =
EdmPrimitiveTypeKind.valueOf(this.fullQualifiedName.getName());{code}
When the code generator tries to access the type of the entity which would not
been done for primitives it throws a NullPointerException.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)