[1.0 RC4] ClassCastException calling getSchemaElement() method in 
org.apache.axis2.description.AxisMessage Class
----------------------------------------------------------------------------------------------------------------

         Key: AXIS2-629
         URL: http://issues.apache.org/jira/browse/AXIS2-629
     Project: Apache Axis 2.0 (Axis2)
        Type: Bug

  Components: client-api  
    Versions: 1.0    
    Reporter: Arnaud MERGEY
    Priority: Minor


 Schema Items are not only XmlSchemaElement so I suggest to replace code of 
getSchemaElement by this one:


public XmlSchemaElement getSchemaElement() {
        AxisService service = (AxisService) getParent().getParent();
        ArrayList schemas = service.getSchema();
        for (int i = 0; i < schemas.size(); i++) {
            XmlSchema schema = (XmlSchema) schemas.get(i);
            XmlSchemaElement xmlSchemaElement = 
schema.getElementByName(getElementQName());
            if (xmlSchemaElement !=null)
                return xmlSchemaElement;
        }
        return null;
    }




or this one:



    public XmlSchemaElement getSchemaElement() {
        AxisService service = (AxisService) getParent().getParent();
        ArrayList schemas = service.getSchema();
        for (int i = 0; i < schemas.size(); i++) {
            XmlSchema schema = (XmlSchema) schemas.get(i);
            Iterator scheamItms = schema.getItems().getIterator();
            while (scheamItms.hasNext()) {
                 Object item=scheamItms.next();
                 if(item instanceof XmlSchemaElement) {
                         XmlSchemaElement xmlSchemaElement = (XmlSchemaElement) 
item;
                         if 
(xmlSchemaElement.getName().equals(getElementQName().getLocalPart())) {
                        return xmlSchemaElement;
                         }
                }
            }
        }
        return null;
    }




-- 
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