commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephan Mikaty <mik...@ecircle-ag.com>
Subject [jxpath] querying a javamail Message
Date Fri, 13 Jun 2003 09:18:42 GMT
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

Mime
View raw message