Cardinality of wildcard element not respected
---------------------------------------------

         Key: TUSCANY-396
         URL: http://issues.apache.org/jira/browse/TUSCANY-396
     Project: Tuscany
        Type: Bug

  Components: Java SDO Implementation  
    Versions: Java-Mx    
    Reporter: Kelvin Goodson


I think there's a problem with the SDO Java setting of open content with 
respect to cardinality.
Given a type ...

xsd:complexType name="OpenQuote">
  <xsd:sequence>
     <xsd:element name="symbol" type="xsd:string"/>
     <xsd:any namespace="##any" maxOccurs="1" />
   </xsd:sequence>
 </xsd:complexType>

  and a global element

 <xsd:element name="note" type="xsd:string"/>


  I'd expect to be able to use generated code in this way ....

      OpenQuote oq = OpenFactory.INSTANCE.createOpenQuote();
      Property pc = 
XSDHelper.INSTANCE.getGlobalProperty("http://www.example.com/open";, "note", 
true);    
      ((DataObject)oq).set(pc, "TBA");

but this fails with a ClassCastException in BasicFeatureMap here ..

  public void set(EStructuralFeature feature, Object object)
  {
    if (isMany(feature))
    {
      List list = list(feature);
      list.clear();
      list.addAll((Collection)object);

this is because the feature that is being tested for isMany(feature) is that 
associated with the global element "note", and not the xsd:any.
The "note" element is marked as maxOccurs=unspecified, and so the set() method 
expects the Object "object" to be a List.  Hence in my
code above I pass in a String, and the cast of String to List unsurprisingly 
fails .



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to