Daniel Barclay wrote:

In JaxMeXS, method XSObject.getLocator() throws an IllegalStateException
when called for a built-in type.  However, the JavaDoc method description
does not specify that the method is allowed to throw IllegalStateException.

Similarly, XSObject.getParentObject() throws an IllegalStateException when called for a built-in type and the JavaDoc method description does not specify that getParentObject() throws IllegalStateException.



Daniel


package test;

import org.apache.ws.jaxme.xs.*;
import org.apache.ws.jaxme.xs.parser.*;
import org.apache.ws.jaxme.xs.xml.*;
import org.xml.sax.*;
import javax.xml.parsers.ParserConfigurationException;


import java.io.*;

public class CheckBug_BuiltinParentException
{


    public static void main( String[] args )
        throws Exception
    {
        System.err.println( "Checking bug: undocumented exception getting 
parent of builtin type" );
        String schemaContent =
            ""
            + "<?xml version=\"1.0\" encoding=\"UTF-8\"?> "
            + "<xsd:schema "
            + "  xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"; "
            + "  xmlns:xsdi=\"http://www.w3.org/2001/XMLSchema-instance\"; "
            + "  xsdi:schemaLocation=\"http://www.w3.org/2001/XMLSchema "
            + "  http://www.w3.org/2001/XMLSchema.xsd\"; "
            + "  > "
            + " "
            + "</xsd:schema> "
            ;

            InputSource source = 
                new InputSource( new ByteArrayInputStream( 
                                     schemaContent.getBytes( "ASCII" ) ) );
            source.setSystemId( "someScheme://x/whatever");

            /**
               Symptom:  ???

             */
            XSParser parser = new XSParser();
            XSSchema schema = parser.parse( source );
            XSType first = schema.getBuiltinTypes()[ 0 ];
            
            try {
                XSObject parent = first.getParentObject();
                System.err.println( "bug fixed" );
            }   
            catch ( IllegalStateException e ) {
                System.err.println( "bug still exists if exception not 
documented" );
            }
            


                
    } // main(...)


} // class CheckBug_BuiltinParentException

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to