Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4424323

javadoc for java.beans.XMLDecoder ctors does not declare IllegalArgumentExceptio

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 1.4.0, 5.0
    • docs
    • generic, sparc
    • generic, solaris_2.6



      Name: dsR10051 Date: 03/12/2001


      Javadoc for constructors of java.beans.XMLDecoder class:
      public XMLDecoder(InputStream in)
      public XMLDecoder(InputStream in, Object owner)
      public XMLDecoder(InputStream in, Object owner, ExceptionListener exceptionListener)
      does not specify the their behavior if InputStream is null.
      In this case constructors throw IllegalArgumentException.
      It should be documented.

      Here is fragment of javadoc comment:
          /**
           * Creates a new input stream for reading archives
           * created by the <code>XMLEncoder</code> class.
           *
           * @param in The underlying stream.
           *
           * @see XMLEncoder#XMLEncoder(OutputStream)
           */
          public XMLDecoder(InputStream in) {

      Here is minimize test:
      import java.beans.*;
      import java.io.InputStream;

      public class XMLDecoderTest01 {

          public static void main (String[] args) {

              InputStream is = null;
              XMLDecoder xml = new XMLDecoder(is);
          }
      }
      --- Output ---
      %java -version
      java version "1.4.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b54)
      Java HotSpot(TM) Client VM (build 1.4beta-B54, mixed mode)
      %java XMLDecoderTest01
      Exception in thread "main" java.lang.IllegalArgumentException: InputStream cannot be null
              at javax.xml.parsers.SAXParser.parse(SAXParser.java:104)
              at java.beans.XMLDecoder.<init>(XMLDecoder.java:90)
              at java.beans.XMLDecoder.<init>(XMLDecoder.java:70)
              at java.beans.XMLDecoder.<init>(XMLDecoder.java:58)
              at XMLDecoderTest01.main(XMLDecoderTest01.java:9)

      ======================================================================

            jgraysunw Joann Gray (Inactive)
            sdasunw Sda Sda (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: