[jdom-interest] Re: BUG in SAXBuilder

정창기 newchang at dreamwiz.com
Thu Feb 22 22:26:04 PST 2001


I noticed that the 'file' stream as an argument of builder.build(file)
in the 'FileReader' block was used in the previous 'BufferedReader'
block.

So I put the some codes into the 'FileReader' block to check that
the 'file' stream is still opened.

  try {
    // build and output with FileReader cast to Reader
    System.out.println("\n\n******************\nbuild and output with FileReader cast to Reader. Ready? (hit 'Enter')");
    System.in.read();System.in.read();

    // added codes
    int ch;
    while((ch = file.read()) != -1) {
      System.out.print((char)ch);
    }

    doc = builder.build((java.io.Reader)file);
    fmt.output(doc, System.out);
  } catch (Exception e) {
    e.printStackTrace();
  }

The execution of the above program issued an error like this.

   java.io.IOException: Stream closed
        at java.io.InputStreamReader.ensureOpen(Unknown Source)
        at java.io.InputStreamReader.read(Unknown Source)
        at java.io.InputStreamReader.read(Unknown Source)
        at RequestParser2.main(RequestParser2.java:77)



More information about the jdom-interest mailing list