Return-Path: Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 60919 invoked from network); 13 Jun 2003 21:06:37 -0000 Received: from web11702.mail.yahoo.com (216.136.172.68) by daedalus.apache.org with SMTP; 13 Jun 2003 21:06:37 -0000 Message-ID: <20030613210644.69713.qmail@web11702.mail.yahoo.com> Received: from [198.204.133.208] by web11702.mail.yahoo.com via HTTP; Fri, 13 Jun 2003 14:06:44 PDT Date: Fri, 13 Jun 2003 14:06:44 -0700 (PDT) From: Dmitri Plotnikov Reply-To: dmitri@apache.org Subject: Re: [jxpath] querying a javamail Message To: Jakarta Commons Users List In-Reply-To: <7CD313D5762E66408873480674125261010BC6@exchange.muc.ecircle.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Stephan, Sorry about the horrible error message. I'll change it to print something more comprehensible. The obvious problem is that you are using 0 instead of 1 to access the first element of the collection (I know, I know... I hate that too. But it's XPath standard - what are you gonna do?) I hope this helps. - Dmitri --- Stephan Mikaty wrote: > Hi everyone, > > I've been trying to use xpath expressions against > a javax.mail.internet.MimeMessage with attachments. > Thi allows me to shorten my junit test cases: > > JXPathContext ctx = JXPathContext.newContext(message); > assertEquals("text/plain", > ctx.getValue("content/bodyPart[0]/contentType")); > > I get the following trace: > > java.lang.NullPointerException > at > org.apache.commons.jxpath.util.ValueUtils.getCollectionHint(ValueUtils.java: > 112) > at > org.apache.commons.jxpath.ri.model.beans.BeanPropertyPointer.isCollection(Be > anPropertyPointer.java:201) > at > org.apache.commons.jxpath.ri.axes.SimplePathInterpreter.isCollectionElement( > SimplePathInterpreter.java:770) > at > org.apache.commons.jxpath.ri.axes.SimplePathInterpreter.doPredicateIndex(Sim > plePathInterpreter.java:674) > at > org.apache.commons.jxpath.ri.axes.SimplePathInterpreter.doPredicate(SimplePa > thInterpreter.java:487) > at > org.apache.commons.jxpath.ri.axes.SimplePathInterpreter.doStepPredicatesProp > ertyOwner(SimplePathInterpreter.java:353) > at > org.apache.commons.jxpath.ri.axes.SimplePathInterpreter.doStep(SimplePathInt > erpreter.java:194) > at > org.apache.commons.jxpath.ri.axes.SimplePathInterpreter.doStepNoPredicatesPr > opertyOwner(SimplePathInterpreter.java:276) > at > org.apache.commons.jxpath.ri.axes.SimplePathInterpreter.doStep(SimplePathInt > erpreter.java:187) > at > org.apache.commons.jxpath.ri.axes.SimplePathInterpreter.interpretSimpleLocat > ionPath(SimplePathInterpreter.java:122) > at > org.apache.commons.jxpath.ri.compiler.Path.getSingleNodePointerForSteps(Path > .java:186) > at > org.apache.commons.jxpath.ri.compiler.LocationPath.computeValue(LocationPath > .java:128) > at > org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.getValue(JXPathConte > xtReferenceImpl.java:287) > at > org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.getValue(JXPathConte > xtReferenceImpl.java:283) > > > Am i doing something wrong? I looked a the code and tried a few > changes, > but couldn't come up with any obvious fix. > > Any help appreciated, > > Stephane > > --------------------------------------------------------------------- > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org > For additional commands, e-mail: commons-user-help@jakarta.apache.org > __________________________________ Do you Yahoo!? Yahoo! Calendar - Free online calendar with sync to Outlook(TM). http://calendar.yahoo.com