[From nobody Fri Aug 6 17:05:03 2004 Delivered-To: jhunter@collab.net Return-Path: jerry.lawson@virtualsummit.com Received: (qmail 95012 invoked from network); 29 Sep 2000 17:00:24 -0000 Received: from mail.acm.org (199.222.69.4) by laswell.collab.net with SMTP; 29 Sep 2000 17:00:24 -0000 Received: from dorothy.denveronline.net (dorothy.denveronline.net [206.168.141.2]) by mail.acm.org (8.9.3/8.9.3) with ESMTP id NAA52386 for <jhunter@acm.org>; Fri, 29 Sep 2000 13:00:19 -0400 Received: from nmemonix.com (www.nmemonix.com [195.74.128.200]) by dorothy.denveronline.net (8.9.3/8.9.3) with SMTP id KAA28305 for <jhunter@jdom.org>; Fri, 29 Sep 2000 10:59:46 -0600 (MDT) Received: (qmail 17073 invoked by uid 514); 29 Sep 2000 17:04:43 -0000 Delivered-To: jhunter@cvs.jdom.org Received: (qmail 17070 invoked from network); 29 Sep 2000 17:04:42 -0000 Received: from mta4.rcsntx.swbell.net (151.164.30.28) by www.nmemonix.com with SMTP; 29 Sep 2000 17:04:42 -0000 Received: from virtualsummit.com ([208.190.38.139]) by mta4.rcsntx.swbell.net (Sun Internet Mail Server sims.3.5.2000.01.05.12.18.p9) with ESMTP id <0G1N003ADQQFG1@mta4.rcsntx.swbell.net> for jhunter@cvs.jdom.org; Fri, 29 Sep 2000 11:49:28 -0500 (CDT) Date: Fri, 29 Sep 2000 11:54:51 -0500 From: Jerry Lawson <jerry.lawson@virtualsummit.com> Subject: bug in Element.java Sender: grl@mta4.rcsntx.swbell.net To: jhunter@cvs.jdom.org Message-id: <39D4C95B.13B9DD03@virtualsummit.com> Organization: Virtual Summit, Inc. MIME-version: 1.0 X-Mailer: Mozilla 4.72 [en] (X11; U; Linux 2.2.14-5.0 i686) Content-type: text/html; charset=us-ascii Content-transfer-encoding: 7bit X-Accept-Language: en X-Mozilla-Status2: 00000000 <!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <html> There appears to be a bug in version 1.32 of Element.java, in getText(): <br>it doesn't check for content==null before accessing its methods. <br>This causes a <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Exception in thread "main" java.lang.NullPointerException: <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at org.jdom.Element.getText(Element.java:420) <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at org.jdom.Element.getTextTrim(Element.java:451) <p>in my application. This can happen when using a schema that defines <br>an element with attributes only (content="empty"). <p>The obvious fix is : <p>if ((content != null) &amp;&amp; (content.size() == 1)) { <br>&nbsp;... <br>} <br><b>else if (content == null)</b> <br><b>{ // handle no content.</b> <br><b>return null;</b> <br><b>}</b> <br><b></b>&nbsp; <p>BTW, I'm sending you this because: <br>&nbsp; 1. there is no (apparent) link to posting bug reports on the jdom.org site. <br>&nbsp; 2. I&nbsp;am not a contributor (although I'd like to be, if I&nbsp;knew how). <p>thanks. <br>&nbsp; <pre>--&nbsp; ___________________________________________________ Jerry Lawson&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Virtual Summit, Inc. Virtual Programmer&nbsp;&nbsp; jerry.lawson@virtualsummit.com</pre> &nbsp;</html> ]