You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xindice-users@xml.apache.org by Michael Wechner <mi...@wyona.com> on 2004/07/06 19:11:21 UTC
NullPointerException when calling getId()
I have the following code snippet:
Resource res = results.nextResource();
log.debug(res.getId());
log.error((String) res.getContent());
res.getId() returns a NullPointer whereas getContent() returns the
actual content just fine.
Any idea what might be wrong? (I guess another stupid question of mine ...)
TIA
Michi
--
Michael Wechner
Wyona Inc. - Open Source Content Management - Apache Lenya
http://www.wyona.com http://cocoon.apache.org/lenya/
michael.wechner@wyona.com michi@apache.org
Re: NullPointerException when calling getId()
Posted by Michael Wechner <mi...@wyona.com>.
>
>
> Can you describe how you got this resource (with null ID)?
as described in the documentation:
String driver = "org.apache.xindice.client.xmldb.DatabaseImpl";
Class c = Class.forName(driver);
Database database = (Database) c.newInstance();
DatabaseManager.registerDatabase(database);
String collection = "xmldb:xindice:///db/test";
log.debug(collection);
col = DatabaseManager.getCollection(collection);
String xpath = "/article/lenya:meta[not(wf:state='live') and
dc:contributor='" + username + "']";
log.debug(xpath);
XPathQueryService service = (XPathQueryService)
col.getService("XPathQueryService", "1.0");
ResourceSet resultSet = service.query(xpath);
if (col != null) {
col.close();
}
That's how I retrieve the resultSet. As said the strange thing is that
getContent() works fine, but getId() returns a NullPointer.
btw, I am using xindice-1.1b4.jar xmldb-api-20030701.jar xmlrpc-1.1.jar
Thanks for your help
Michi
>
> Vadim
>
>
--
Michael Wechner
Wyona Inc. - Open Source Content Management - Apache Lenya
http://www.wyona.com http://cocoon.apache.org/lenya/
michael.wechner@wyona.com michi@apache.org
Re: NullPointerException when calling getId()
Posted by Vadim Gritsenko <va...@reverycodes.com>.
Michael Wechner wrote:
> I have the following code snippet:
>
> Resource res = results.nextResource();
> log.debug(res.getId());
> log.error((String) res.getContent());
>
> res.getId() returns a NullPointer whereas getContent() returns the
> actual content just fine.
>
> Any idea what might be wrong? (I guess another stupid question of mine
> ...)
Can you describe how you got this resource (with null ID)?
Vadim