[kaffe] CVS kaffe (dalibor): Resynced with GNU JAXP

Kaffe CVS Kaffe Mailing List <kaffe@kaffe.org>
Mon Sep 15 08:51:02 2003


PatchSet 4037 
Date: 2003/09/15 15:47:59
Author: dalibor
Branch: HEAD
Tag: (none) 
Log:
Resynced with GNU JAXP

Jim's patch has made it into GNU JAXP, so I resynced with their CVS.

Members: 
	ChangeLog:1.1633->1.1634 
	libraries/javalib/javax/xml/parsers/DocumentBuilder.java:1.1->1.2 
	libraries/javalib/javax/xml/parsers/DocumentBuilderFactory.java:1.1->1.2 
	libraries/javalib/javax/xml/parsers/SAXParser.java:1.1->1.2 
	libraries/javalib/javax/xml/transform/TransformerConfigurationException.java:1.1->1.2 
	libraries/javalib/javax/xml/transform/TransformerException.java:1.1->1.2 
	libraries/javalib/javax/xml/transform/sax/SAXSource.java:1.2->1.3 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.1633 kaffe/ChangeLog:1.1634
--- kaffe/ChangeLog:1.1633	Sun Sep 14 21:49:34 2003
+++ kaffe/ChangeLog	Mon Sep 15 15:47:59 2003
@@ -1,3 +1,13 @@
+2003-09-15  Dalibor Topic <robilad@kaffe.org>
+	
+	* libraries/javalib/javax/xml/parsers/DocumentBuilder.java,
+	libraries/javalib/javax/xml/parsers/DocumentBuilderFactory.java,
+	libraries/javalib/javax/xml/parsers/SAXParser.java,
+	libraries/javalib/javax/xml/transform/TransformerConfigurationException.java,
+	libraries/javalib/javax/xml/transform/TransformerException.java,
+	libraries/javalib/javax/xml/transform/sax/SAXSource.java:
+	Resynced with GNU JAXP.
+	
 2003-09-14  Dalibor Topic <robilad@kaffe.org>
 
 	* libraries/javalib/Klasses.jar.bootstrap:
Index: kaffe/libraries/javalib/javax/xml/parsers/DocumentBuilder.java
diff -u kaffe/libraries/javalib/javax/xml/parsers/DocumentBuilder.java:1.1 kaffe/libraries/javalib/javax/xml/parsers/DocumentBuilder.java:1.2
--- kaffe/libraries/javalib/javax/xml/parsers/DocumentBuilder.java:1.1	Mon Dec  2 15:01:14 2002
+++ kaffe/libraries/javalib/javax/xml/parsers/DocumentBuilder.java	Mon Sep 15 15:48:01 2003
@@ -1,5 +1,5 @@
 /*
- * $Id: DocumentBuilder.java,v 1.1 2002/12/02 15:01:14 dalibor Exp $
+ * $Id: DocumentBuilder.java,v 1.2 2003/09/15 15:48:01 dalibor Exp $
  * Copyright (C) 2001 Andrew Selkirk
  * Copyright (C) 2001 David Brownell
  * 
@@ -46,7 +46,7 @@
 /**
  * Uses an XML parser to construct a DOM document.
  * @author	Andrew Selkirk, David Brownell
- * @version	$Id: DocumentBuilder.java,v 1.1 2002/12/02 15:01:14 dalibor Exp $
+ * @version	$Id: DocumentBuilder.java,v 1.2 2003/09/15 15:48:01 dalibor Exp $
  */
 public abstract class DocumentBuilder
 {
@@ -96,17 +96,30 @@
 	/**
 	 * Constructs an InputSource from the file, and invokes parse ().
 	 * The InputSource includes the URI for the file.
+   * @param file the file to parse
+   * @return the DOM representation of the xml document
+   * @exception IOException 
+   * @exception SAXException if parse errors occur
+   * @exception IllegalArgumentException if the file is null
 	 */
 	public Document parse (File file) 
 	throws SAXException, IOException
 	{
-	    InputSource	source;
-
-	    source = new InputSource (fileToURL (file));
-	    source.setByteStream (new FileInputStream(file));
-	    return parse (source);
+    if (file==null)
+      {
+        throw new IllegalArgumentException("File si 'null'");
+      }
+    InputSource	source;
+    
+    source = new InputSource (fileToURL (file));
+    source.setByteStream (new FileInputStream(file));
+    return parse (source);
 	}
-
+  
+  /**
+   * 
+   * @exception IllegalArgumentException if InputSource is null
+   */
 	public abstract Document parse(InputSource source) 
 		throws SAXException, IOException;
 
@@ -114,15 +127,28 @@
 	 * Avoid using this call; provide the system ID wherever possible.
 	 * System IDs are essential when parsers resolve relative URIs,
 	 * or provide diagnostics.
+   * @exception IllegalArgumentException if InputStream is null
 	 */
 	public Document parse(InputStream stream) 
 		throws SAXException, IOException {
+    if (stream==null)
+    {
+      throw new IllegalArgumentException("InputStream si 'null'");
+    }
 		return parse(new InputSource(stream));
 	} // parse()
 
+  /**
+   * 
+   * @exception IllegalArgumentException if InputStream is null
+   */
 	public Document parse(InputStream stream, String systemID) 
 		throws SAXException, IOException {
 
+    if (stream==null)
+      {
+        throw new IllegalArgumentException("InputStream si 'null'");
+      }
 		// Variables
 		InputSource	source;
 
@@ -135,11 +161,19 @@
 
 	} // parse()
 
+  /**
+   * 
+   * @exception IllegalArgumentException if the URI is null
+   */
 	public Document parse(String uri) 
 		throws SAXException, IOException {
+    if (uri==null)
+      {
+        throw new IllegalArgumentException("URI si 'null'");
+      }
 		return parse(new InputSource(uri));
 	} // parse()
-
+  
 	public abstract void setEntityResolver(EntityResolver resolver);
 
 	public abstract void setErrorHandler(ErrorHandler handler);
Index: kaffe/libraries/javalib/javax/xml/parsers/DocumentBuilderFactory.java
diff -u kaffe/libraries/javalib/javax/xml/parsers/DocumentBuilderFactory.java:1.1 kaffe/libraries/javalib/javax/xml/parsers/DocumentBuilderFactory.java:1.2
--- kaffe/libraries/javalib/javax/xml/parsers/DocumentBuilderFactory.java:1.1	Mon Dec  2 15:01:15 2002
+++ kaffe/libraries/javalib/javax/xml/parsers/DocumentBuilderFactory.java	Mon Sep 15 15:48:01 2003
@@ -1,5 +1,5 @@
 /*
- * $Id: DocumentBuilderFactory.java,v 1.1 2002/12/02 15:01:15 dalibor Exp $
+ * $Id: DocumentBuilderFactory.java,v 1.2 2003/09/15 15:48:01 dalibor Exp $
  * Copyright (C) 2001 Andrew Selkirk
  * Copyright (C) 2001 David Brownell
  * 
@@ -43,7 +43,7 @@
  * W3C DOM APIs don't include portable bootstrapping.
  *
  * @author	Andrew Selkirk, David Brownell
- * @version	$Id: DocumentBuilderFactory.java,v 1.1 2002/12/02 15:01:15 dalibor Exp $
+ * @version	$Id: DocumentBuilderFactory.java,v 1.2 2003/09/15 15:48:01 dalibor Exp $
  */
 public abstract class DocumentBuilderFactory {
 
@@ -74,6 +74,9 @@
 	// Methods ----------------------------------------------------
 	//-------------------------------------------------------------
 
+  /**
+   * @exception IllegalArgumentException if implementation doesn't recognize the attribute
+   */
 	public abstract Object getAttribute(String name) 
 		throws IllegalArgumentException;
 
@@ -104,6 +107,9 @@
 	public abstract DocumentBuilder newDocumentBuilder()
 		throws ParserConfigurationException;
 
+  /**
+   * @exception FactoryConfigurationError if the implementation is not available
+   */
 	public static DocumentBuilderFactory newInstance() {
 		try {
 		    return (DocumentBuilderFactory)
@@ -116,6 +122,9 @@
 		}
 	}
 
+  /**
+   * @exception IllegalArgumentException if implementation doesn't recognize the attribute
+   */
 	public abstract void setAttribute(String name, Object value) 
 		throws IllegalArgumentException;
 
Index: kaffe/libraries/javalib/javax/xml/parsers/SAXParser.java
diff -u kaffe/libraries/javalib/javax/xml/parsers/SAXParser.java:1.1 kaffe/libraries/javalib/javax/xml/parsers/SAXParser.java:1.2
--- kaffe/libraries/javalib/javax/xml/parsers/SAXParser.java:1.1	Mon Dec  2 15:01:15 2002
+++ kaffe/libraries/javalib/javax/xml/parsers/SAXParser.java	Mon Sep 15 15:48:01 2003
@@ -1,5 +1,5 @@
 /*
- * $Id: SAXParser.java,v 1.1 2002/12/02 15:01:15 dalibor Exp $
+ * $Id: SAXParser.java,v 1.2 2003/09/15 15:48:01 dalibor Exp $
  * Copyright (C) 2001 Andrew Selkirk
  * Copyright (C) 2001 David Brownell
  * 
@@ -71,6 +71,7 @@
 	 * Avoid using this API, since relative URIs in the document need
 	 * to be resolved against the document entity's URI, and good
 	 * diagnostics also need that URI.
+   * @exception IllegalArgumentException if InputStream is null
 	 */
 	public void parse(InputStream stream, HandlerBase handler) 
 	throws SAXException, IOException
@@ -79,6 +80,7 @@
 	/**
 	 * Parse using (deprecated) SAX1 style handlers,
 	 * and a byte stream with a specified URI.
+   * @exception IllegalArgumentException if InputStream is null
 	 */
 	public void parse (
 		InputStream stream,
@@ -86,6 +88,10 @@
 		String systemID
 	) throws SAXException, IOException
 	{
+    if(stream==null)
+      {
+        throw new IllegalArgumentException("InputStream is 'null'");
+      }
 		InputSource	source;
 
 		// Prepare Source
@@ -102,14 +108,22 @@
 	 * Avoid using this API, since relative URIs in the document need
 	 * to be resolved against the document entity's URI, and good
 	 * diagnostics also need that URI.
+   * @exception IllegalArgumentException if InputStream is null
 	 */
 	public void parse(InputStream stream, DefaultHandler def) 
 	throws SAXException, IOException
-	    { parse (new InputSource (stream), def); }
+  {
+    if(stream==null)
+      {
+        throw new IllegalArgumentException("InputStream is 'null'");
+      }
+    parse (new InputSource (stream), def);
+  }
 
 	/**
 	 * Parse using SAX2 style handlers,
 	 * and a byte stream with a specified URI.
+   * @exception IllegalArgumentException if InputStream is null
 	 */
 	public void parse (
 		InputStream stream,
@@ -117,6 +131,10 @@
 		String systemID
 	) throws SAXException, IOException
 	{
+    if(stream==null)
+      {
+        throw new IllegalArgumentException("InputStream is 'null'");
+      }
 		InputSource	source;
 
 		// Prepare Source
@@ -130,26 +148,45 @@
 	/**
 	 * Parse using (deprecated) SAX1 style handlers,
 	 * and a URI for the document entity.
+   * @exception IllegalArgumentException if URI is null
 	 */
 	public void parse(String uri, HandlerBase handler) 
 	throws SAXException, IOException
-	    { parse (new InputSource (uri), handler); }
+  {
+    if(uri==null)
+      {
+        throw new IllegalArgumentException("URI is 'null'");
+      }
+    parse (new InputSource (uri), handler);
+  }
 
 	/**
 	 * Parse using SAX2 style handlers,
 	 * and a URI for the document entity.
+   * @exception IllegalArgumentException if URI is null
 	 */
 	public void parse(String uri, DefaultHandler def) 
 	throws SAXException, IOException
-	    { parse (new InputSource (uri), def); }
+  {
+    if(uri==null)
+      {
+        throw new IllegalArgumentException("URI is 'null'");
+      }
+    parse (new InputSource (uri), def);
+  }
 
 	/**
 	 * Parse using (deprecated) SAX1 style handlers,
 	 * turning a file name into the document URI.
+   * @exception IllegalArgumentException if file is null
 	 */
 	public void parse(File file, HandlerBase handler) 
 	throws SAXException, IOException
 	{
+    if(file==null)
+      {
+        throw new IllegalArgumentException("The file is 'null'");
+      }
 		InputSource	in;
 		
 		in = new InputSource (DocumentBuilder.fileToURL (file));
@@ -159,10 +196,15 @@
 	/**
 	 * Parse using SAX2 style handlers,
 	 * turning a file name into the document URI.
+   * @exception IllegalArgumentException if file is null
 	 */
 	public void parse(File file, DefaultHandler def) 
 	throws SAXException, IOException
 	{
+    if(file==null)
+      {
+        throw new IllegalArgumentException("The file is 'null'");
+      }
 		InputSource	in;
 		
 		in = new InputSource (DocumentBuilder.fileToURL (file));
@@ -171,10 +213,15 @@
 
 	/**
 	 * Parse using (deprecated) SAX1 style handlers.
+   * @exception IllegalArgumentException if InputSource is null
 	 */
 	public void parse(InputSource source, HandlerBase handler) 
 	throws SAXException, IOException
 	{
+    if(source==null)
+      {
+        throw new IllegalArgumentException("The InputSource is 'null'");
+      }
 		Parser	parser;
 
 		// Prepare Parser
@@ -191,10 +238,15 @@
 
 	/**
 	 * Parse using SAX2 style handlers.
+   * @exception IllegalArgumentException if InputSource is null
 	 */
 	public void parse(InputSource source, DefaultHandler def) 
 	throws SAXException, IOException
 	{
+    if(source==null)
+      {
+        throw new IllegalArgumentException("The InputSource is 'null'");
+      }
 		XMLReader	reader;
 
 		// Prepare XML Reader
@@ -217,6 +269,7 @@
 
 	/**
 	 * Get a SAX2 driver for the underlying parser.
+   * @since 1.1
 	 */
 	public abstract XMLReader getXMLReader() throws SAXException;
 
Index: kaffe/libraries/javalib/javax/xml/transform/TransformerConfigurationException.java
diff -u kaffe/libraries/javalib/javax/xml/transform/TransformerConfigurationException.java:1.1 kaffe/libraries/javalib/javax/xml/transform/TransformerConfigurationException.java:1.2
--- kaffe/libraries/javalib/javax/xml/transform/TransformerConfigurationException.java:1.1	Mon Dec  2 15:01:58 2002
+++ kaffe/libraries/javalib/javax/xml/transform/TransformerConfigurationException.java	Mon Sep 15 15:48:02 2003
@@ -1,5 +1,5 @@
 /*
- * $Id: TransformerConfigurationException.java,v 1.1 2002/12/02 15:01:58 dalibor Exp $
+ * $Id: TransformerConfigurationException.java,v 1.2 2003/09/15 15:48:02 dalibor Exp $
  * Copyright (C) 2001 Andrew Selkirk
  * 
  * This file is part of GNU JAXP, a library.
@@ -33,6 +33,8 @@
  */
 public class TransformerConfigurationException extends TransformerException {
 
+  protected SourceLocator locator = null;
+  
 	//-------------------------------------------------------------
 	// Initialization ---------------------------------------------
 	//-------------------------------------------------------------
@@ -53,6 +55,15 @@
 		super(msg, ex);
 	} // TransformerConfigurationException()
 
+  public TransformerConfigurationException(String msg, SourceLocator locator) {
+    super(msg);
+    this.locator = locator;
+  }
+
+  public TransformerConfigurationException(String msg, SourceLocator locator, Throwable ex) {
+    super(msg, ex);
+    this.locator = locator;
+  }  
 
 } // TranformerConfigurationException
 
Index: kaffe/libraries/javalib/javax/xml/transform/TransformerException.java
diff -u kaffe/libraries/javalib/javax/xml/transform/TransformerException.java:1.1 kaffe/libraries/javalib/javax/xml/transform/TransformerException.java:1.2
--- kaffe/libraries/javalib/javax/xml/transform/TransformerException.java:1.1	Mon Dec  2 15:01:59 2002
+++ kaffe/libraries/javalib/javax/xml/transform/TransformerException.java	Mon Sep 15 15:48:02 2003
@@ -1,5 +1,5 @@
 /*
- * $Id: TransformerException.java,v 1.1 2002/12/02 15:01:59 dalibor Exp $
+ * $Id: TransformerException.java,v 1.2 2003/09/15 15:48:02 dalibor Exp $
  * Copyright (C) 2001 Andrew Selkirk
  * Copyright (C) 2001 David Brownell
  * 
@@ -160,7 +160,7 @@
 
 
 	public void printStackTrace() {
-		printStackTrace(System.out);
+		printStackTrace(System.out);// shouldn't it be System.err?
 	}
 
 	public void printStackTrace(PrintStream stream) {
Index: kaffe/libraries/javalib/javax/xml/transform/sax/SAXSource.java
diff -u kaffe/libraries/javalib/javax/xml/transform/sax/SAXSource.java:1.2 kaffe/libraries/javalib/javax/xml/transform/sax/SAXSource.java:1.3
--- kaffe/libraries/javalib/javax/xml/transform/sax/SAXSource.java:1.2	Wed Aug 27 21:12:08 2003
+++ kaffe/libraries/javalib/javax/xml/transform/sax/SAXSource.java	Mon Sep 15 15:48:02 2003
@@ -1,5 +1,5 @@
 /*
- * $Id: SAXSource.java,v 1.2 2003/08/27 21:12:08 jim Exp $
+ * $Id: SAXSource.java,v 1.3 2003/09/15 15:48:02 dalibor Exp $
  * Copyright (C) 2001 Andrew Selkirk
  * Copyright (C) 2001 David Brownell
  * 
@@ -122,11 +122,11 @@
 	{
 	    InputSource	retval;
 	    boolean	ok = false;
-
-	    if (in instanceof SAXSource) {
-	    	return ((SAXSource) in).inputSource;
-	    }
-
+      
+      if (in instanceof SAXSource) {
+        return ((SAXSource) in).inputSource;
+      }
+      
 	    if (in.getSystemId () != null) {
 		retval = new InputSource (in.getSystemId ());
 		ok = true;