chandransalem / odata4j

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

Entity property of type Edm.SByte breaks edmx parsing #139

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

1. Consume a service which defines an entity type property of type Edm.SByte.
2. The official SAP Netweaver Gateway demo service can be used to reproduce the 
problem: 
http://gw.esworkplace.sap.com/sap/opu/sdata/iwcnt/contact/$metadata

What is the expected output? What do you see instead?

Parsing the entity data model throws an exception:

java.lang.RuntimeException: Edm-type not found: Edm.SByte
    at org.odata4j.edm.EdmType$DeferredBuilder.buildImpl(EdmType.java:141)
    at org.odata4j.edm.EdmType$Builder._build(EdmType.java:107)
    at org.odata4j.edm.EdmType$DeferredBuilder.build(EdmType.java:134)
    at org.odata4j.edm.EdmProperty$Builder.build(EdmProperty.java:209)
    at org.odata4j.edm.EdmStructuralType.<init>(EdmStructuralType.java:41)
    at org.odata4j.edm.EdmEntityType.<init>(EdmEntityType.java:42)
    at org.odata4j.edm.EdmEntityType.<init>(EdmEntityType.java:31)
    at org.odata4j.edm.EdmEntityType$Builder.buildImpl(EdmEntityType.java:159)
    at org.odata4j.edm.EdmEntityType$Builder.buildImpl(EdmEntityType.java:119)
    at org.odata4j.edm.EdmType$Builder._build(EdmType.java:107)
    at org.odata4j.edm.EdmEntityType$Builder.build(EdmEntityType.java:150)
    at org.odata4j.edm.EdmSchema$Builder.build(EdmSchema.java:129)
    at org.odata4j.edm.EdmDataServices$Builder.build(EdmDataServices.java:230)
    at org.odata4j.format.xml.EdmxFormatParser.parseMetadata(EdmxFormatParser.java:80)
    at org.odata4j.jersey.consumer.ODataJerseyClient.getMetadata(ODataJerseyClient.java:67)
    at org.odata4j.jersey.consumer.ODataJerseyConsumer$CachedEdmDataServices.refreshDelegate(ODataJerseyConsumer.java:319)
    at org.odata4j.jersey.consumer.ODataJerseyConsumer$CachedEdmDataServices.getDelegate(ODataJerseyConsumer.java:313)
    at org.odata4j.internal.EdmDataServicesDecorator.findEdmEntitySet(EdmDataServicesDecorator.java:46)
    at org.odata4j.jersey.consumer.ODataJerseyConsumer$CachedEdmDataServices.findEdmEntitySet(ODataJerseyConsumer.java:325)
    at org.odata4j.jersey.consumer.ODataJerseyConsumer.getFeedCustomizationMapping(ODataJerseyConsumer.java:286)
    at org.odata4j.jersey.consumer.ODataJerseyConsumer.getEntities(ODataJerseyConsumer.java:158)
    at org.odata4j.consumer.AbstractODataConsumer.getEntities(AbstractODataConsumer.java:57)

What version of the product are you using? On what operating system?

0.5 / 0.6-SNAPSHOT

Please provide any additional information below.

The Edm.SByte simple type (contains a signed 8-bit integer value) is currently 
not supported in odata4j. OData4j only defines Edm.Byte and maps it to 
java.lang.Byte (Edm.Byte is defined as unsigned 8-bit integer value).

As I have to consume SAP Netweaver Gateway services, I defined a new SByte 
member in EdmSimpleType as EdmSimpleType<Byte>. While that is more or less a 
workaround which maps SByte to java.lang.Byte, 
it allows consuming data services with SByte properties.

Original issue reported on code.google.com by manuel.r...@gmail.com on 21 Feb 2012 at 9:52

GoogleCodeExporter commented 8 years ago
Patch for Edm.SByte support.

Original comment by manuel.r...@gmail.com on 21 Feb 2012 at 9:54

Attachments:

GoogleCodeExporter commented 8 years ago
Thanks, I'll take a look.

Perhaps we should have java.lang.Byte (signed) map exclusively to Edm.SByte, 
and introduce a new UnsignedByte type (no jdk equiv) to map to Edm.Byte.

Original comment by john.spurlock on 21 Feb 2012 at 1:59

GoogleCodeExporter commented 8 years ago
Yes, that would be the best solution. I just needed a quick fix when I ran into 
this issue and came up with this patch. I would like to implement a new 
UnsignedByte type as soon as I have the time and will send you a new patch (or 
commit directly if it is okay for you).

Regards,
Manuel

Original comment by manuel.r...@gmail.com on 21 Feb 2012 at 7:36

GoogleCodeExporter commented 8 years ago

Original comment by john.spurlock on 25 Feb 2012 at 3:53

GoogleCodeExporter commented 8 years ago
Integrated patch as revision d9e08c6dc731

Leaving this issue open until we address unsigned bytes.

Original comment by john.spurlock on 25 Feb 2012 at 4:14

GoogleCodeExporter commented 8 years ago
This issue was closed by revision 9b1af560e22f.

Original comment by john.spurlock on 3 Mar 2012 at 10:34

GoogleCodeExporter commented 8 years ago
Added UnsignedByte type and mapped to Edm.Byte, should be all set.

Original comment by john.spurlock on 3 Mar 2012 at 10:35