[ 
https://issues.apache.org/jira/browse/OLINGO-1167?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16389646#comment-16389646
 ] 

Stefan Hasse commented on OLINGO-1167:
--------------------------------------

still an issue... is there at least a validation of "reserved" entity-names 
planned to prevent usage of Edm primitives?

> 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.2.0, (Java) V4 4.3.0
>         Environment: EntityType with same name as EdmPrimitiveTypeKind. For 
> instance: Binary
>            Reporter: Simon Ammer
>            Priority: Critical
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> 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 it throws a 
> NullPointerException.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to