[jdom-interest] Always been there?

Brett McLaughlin brett at newInstance.com
Wed Apr 4 22:14:22 PDT 2001


Anyone know if I'm loony, or has this (what appears to me as a bug) always
been there:

This code outputs a file of 0 bytes:

        Element root = new Element("properties");
        Document doc = new Document(root);

        // Output document to supplied filename
        XMLOutputter outputter = new XMLOutputter("  ", true);
        outputter.output(doc, writer);
        writer.flush();

This code works fine:

        Element root = new Element("properties");
        Document doc = new Document(root);

        // Output document to supplied filename
        XMLOutputter outputter = new XMLOutputter("  ", true);
        outputter.output(doc, writer);
        writer.flush();

Since when has it been the programmer's job to do a flush() on their own?
Seems sort of weird... In this case, the Writer wraps an OutputStreamWriter,
but that shouldn't matter, right?

-Brett




More information about the jdom-interest mailing list