[jdom-interest] XMLOutputter to the rescue (get/setText)

Elliotte Rusty Harold elharo at metalab.unc.edu
Thu Jul 12 06:25:27 PDT 2001

At 5:37 PM -0700 7/11/01, guru at stinky.com wrote:

>>  The current behavior is simply not an option, even with a Javadoc
>> note on the point. It's just way too dangerous.
>It's dangerous because...?  I agree it's a little unintuitive, but not
>dangerous.  (Not as dangerous as an unchecked exception, for instance,
>which could unexpectedly kill a thread without warning.)

The current behavior is dangerous because I might write code, test it, see that it's working, put it into production and have it run correctly for two weeks at which points somebody throws a document that's formed in a slightly different way at it and it processes it incorrectly. Consequently a trade doesn't get executed that should be, or vice versa, or it gets executed at the wrong price. A laser scalpel cuts along the wrong coordinates. A nuclear reactor fails to shut down. Most cases would be less catastrophic than this, but you get the idea. 

If I have designed my code to miss handling an important case, then it should immediately notify someone that it's entered an unexpected state that it cannot properly handle. I would prefer to make this particular exception a checked exception so that programmers would be forced to consider the possibility of mixed content and how they'll handle it if it arrives. But regardless of whether the exception is checked or unchecked, silent failure is not an option. The method either succeeds or it tells somebody that it failed. 

| Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
|          The XML Bible, 2nd Edition (Hungry Minds, 2001)           |
|              http://www.ibiblio.org/xml/books/bible2/              |
|   http://www.amazon.com/exec/obidos/ISBN=0764547607/cafeaulaitA/   |
|  Read Cafe au Lait for Java News:  http://www.cafeaulait.org/      | 
|  Read Cafe con Leche for XML News: http://www.ibiblio.org/xml/     |

More information about the jdom-interest mailing list