neilg 2003/02/10 14:21:34 Modified: java/src/org/apache/xerces/parsers AbstractSAXParser.java Log: SAX 2.0 conformance bug. When a null DTDHandler, ContentHandler, ErrorHandler or EntityResolver is registered with the XMLReader, SAX 2.0 clearly requires an NPE to be thrown. While this is at variance with both SAX 1 and SAX 2.0.1, to conform to SAX 2.0 this behaviour is necessary. Revision Changes Path 1.39 +16 -2 xml-xerces/java/src/org/apache/xerces/parsers/AbstractSAXParser.java Index: AbstractSAXParser.java =================================================================== RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/AbstractSAXParser.java,v retrieving revision 1.38 retrieving revision 1.39 diff -u -r1.38 -r1.39 --- AbstractSAXParser.java 21 Jan 2003 23:43:36 -0000 1.38 +++ AbstractSAXParser.java 10 Feb 2003 22:21:34 -0000 1.39 @@ -2,7 +2,7 @@ * The Apache Software License, Version 1.1 * * - * Copyright (c) 2001, 2002 The Apache Software Foundation. + * Copyright (c) 2001-2003 The Apache Software Foundation. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -1172,6 +1172,10 @@ */ public void setEntityResolver(EntityResolver resolver) { + // not per SAX 1, but per SAX 2.0 and JAXP 1.1 expectations + if(resolver == null) { + throw new NullPointerException(); + } try { fConfiguration.setProperty(ENTITY_RESOLVER, new EntityResolverWrapper(resolver)); @@ -1227,6 +1231,10 @@ */ public void setErrorHandler(ErrorHandler errorHandler) { + // not per SAX 1, but per SAX 2.0 and JAXP 1.1 expectations + if(errorHandler == null) { + throw new NullPointerException(); + } try { fConfiguration.setProperty(ERROR_HANDLER, new ErrorHandlerWrapper(errorHandler)); @@ -1301,6 +1309,8 @@ // to be thrown but SAX2 does. [Q] How do we // resolve this? Currently I'm erring on the side // of SAX2. -Ac + // This is what the JCK requires; 2.0 is assumed to supersede the + // SAX 1 behaviour - neilg if (dtdHandler == null) { throw new NullPointerException(); } @@ -1352,6 +1362,10 @@ * @see #getContentHandler */ public void setContentHandler(ContentHandler contentHandler) { + // not per SAX 1, but per SAX 2.0 and JAXP 1.1 expectations + if(contentHandler == null) { + throw new NullPointerException(); + } fContentHandler = contentHandler; } // setContentHandler(ContentHandler)
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]