murataydogdu / odata4j

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

XmlFormatWriter does not respect the FullyQualifiedTypeName of collection types. #223

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create an OCollection with EdmCollectionType.kind != Bag
2. Serialize an instance of the collection using XmlFormatWriter.

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

After creating a type like:

EdmCollectionType edmCollectionType = EdmCollectionType.newBuilder()
     .setKind(EdmProperty.CollectionKind.Collection)
     .setCollectionType(edmComplexTypeBuilder)
     .build();

...then passing it to the OCollections builder, I expected to see..

<d:someIntegerArray m:type="Collection(Public.Object)">
  <d:element>1.0</d:element> 
  <d:element>2.0</d:element> 
  <d:element>3.0</d:element> 
  <d:element>4.0</d:element> 
</d:someIntegerArray>

instead I get...

<d:someIntegerArray m:type="Bag(Public.Object)">
  <d:element>1.0</d:element> 
  <d:element>2.0</d:element> 
  <d:element>3.0</d:element> 
  <d:element>4.0</d:element> 
</d:someIntegerArray>

What version of the product are you using? On what operating system?
0.6.0 on Win32 and RHEL.

Please provide any additional information below.

// from XmlFormatWriter.writeProperty()...

        String typename = type.getFullyQualifiedTypeName();
        if (value instanceof OCollection) {
          EdmCollectionType collectionType = (EdmCollectionType) type;
          typename = "Bag(" + collectionType.getItemType().getFullyQualifiedTypeName() + ")";
        }

Changing the collection type to List or Collection obviously has no effect...

Using the Simple.Data.OData client on .NET 4.0 - the collections are handled 
properly (as collections rather than maps) when 
m:type="Collection(Public.Object)" - this client fails with duplicate key 
violations when m:type="Bag(Public.Object)".

Thanks for the great work BTW.

Original issue reported on code.google.com by mike.fu...@googlemail.com on 30 Oct 2012 at 12:59

GoogleCodeExporter commented 8 years ago
Same issue, when will this be fixed the AtomFeedFormatParser can't handle it

java.lang.RuntimeException: unknown property type: 
Bag(com.ca.clarity.studio.Segment)
    at org.odata4j.format.xml.AtomFeedFormatParser.parseProperties(AtomFeedFormatParser.java:211)
    at org.odata4j.format.xml.AtomFeedFormatParser.parseProperties(AtomFeedFormatParser.java:223)
    at org.odata4j.format.xml.AtomFeedFormatParser.parseDSAtomEntry(AtomFeedFormatParser.java:273)
    at org.odata4j.format.xml.AtomFeedFormatParser.parseEntry(AtomFeedFormatParser.java:383)
    at org.odata4j.format.xml.AtomFeedFormatParser.parseFeed(AtomFeedFormatParser.java:169)
    at org.odata4j.format.xml.AtomFeedFormatParser.parse(AtomFeedFormatParser.java:157)
    at org.odata4j.format.xml.AtomFeedFormatParser.parse(AtomFeedFormatParser.java:45)
    at org.odata4j.consumer.ConsumerGetEntityRequest.execute(ConsumerGetEntityRequest.java:83)

Original comment by david.be...@ca.com on 30 Oct 2012 at 4:30