hi ajith,

did you change this method recently in XmlSchema.

public XmlSchemaType getTypeByName(QName name) {
        XmlSchemaType type = (XmlSchemaType) schemaTypes.getItem(name);
        if (type == null){
            //search the imports
            for(Iterator includedItems = includes.getIterator
();includedItems.hasNext();){
                Object includeOrImport =  includedItems.next();
                XmlSchema schema = null;
                if (includeOrImport instanceof XmlSchemaImport){
                    schema  =
((XmlSchemaImport)includeOrImport).getSchema();
                }else if (includeOrImport instanceof XmlSchemaInclude){
                    schema  =
((XmlSchemaInclude)includeOrImport).getSchema();
                }else{
                    //skip ?
                    continue;
                }

                if (schema.getTypeByName(name)!=null){
                    return schema.getTypeByName(name);
                }
            }
        }else{
            return type;
        }

        return null;
    }

Earlier it does not search for imported and included schemas.
As I see this method has two problems.
1. the imported schema may be null if we have inline schemas in a wsdl. so
there can be a null pointer
exception
2. what about the recuresive imports?
if there are two scheams with imports each other and if we try to find a
Type which is not exists (or exists in anther import) there may be an
endless loop.

Any way the biggest problem is this breaks ADB.
ADB Schema Compiler needs to keep the track of the parent schema. So what it
does is
it find it in available imports and includes if a Type does not exists in a
given schema. (as you have done).

This way it can not track the parent schema.

So shall we add a another parameter to preserve this functionality.
i.e.
public XmlSchemaType getTypeByName(QName name, boolean isDeepSearch)

Amila.


On 10/23/07, Ruwan Linton <[EMAIL PROTECTED]> wrote:
>
> We have tested this with the Synapse build and it is working fine.
>
> +1 for the release.
>
> Thanks,
> Ruwan
>
> On 10/23/07, Ajith Ranabahu <[EMAIL PROTECTED]> wrote:
> >
> > Hi all,
> > I have branched the XMLSchema trunk (
> >
> >
> http://svn.apache.org/viewvc/webservices/commons/branches/modules/XmlSchema/1.3.3/
> > ) and posted the candidate artifacts at
> > http://people.apache.org/~ajith/xmlschema/. Please take a look, try
> > them out and report any concerns in the mailing list.
> >
> > I have fixed about 7 Jiras (as I felt important) but kept two of them
> > unresolved. Issues 264 and 265 are fixed in the code but may need more
> > discussion (perhaps from the tuscany folks) to be marked as resolved.
> > Relevance of other issues is somewhat questionable so I left them
> > unchanged.
> >
> > Here is my +1 for the release.
> >
> > --
> > Ajith Ranabahu
> >
> > Reading, after a certain age, diverts the mind too much from its
> > creative pursuits. Any man who reads too much and uses his own brain
> > too little falls into lazy habits of thinking - Albert Einstein
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
> --
> Ruwan Linton
> http://www.wso2.org - "Oxygenating the Web Services Platform"
>



-- 
Amila Suriarachchi,
WSO2 Inc.

Reply via email to