You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xindice-dev@xml.apache.org by Daniel Migowski <Mi...@artis.uni-oldenburg.de> on 2004/10/29 20:37:49 UTC
Bug: Mixing binary and xml content in collection results to exceptions when doing an xquery - patch provided
Hello Xindice developers,
I just found a bug in org.apache.xindice.core.Collection, that resulted in a wrong "not a document" Exception.
Versions:
The error occurs in cvs- and 1.1b4-release.
What was wrong:
When inserting binary and xml-documents into the same collection, a
query results in an exception.
What did i fix:
I changed "Document getDocument(Object key)" to first have a look if
the ressource is a binary ressource, and then just returning null
instead of an XMLDocument, like if the ressource wasn't there at all.
How to test it:
I appended a small test class, and my change (not in diff-format, but
just replace the corresponding function, please.)
Ciao,
Mig-O
------------------------
public final Document getDocument(Object key) throws DBException {
if (log.isDebugEnabled()) {
log.debug(debugHeader() + "Get document: " + key);
}
Object entry = getEntry(key);
if (entry == null) {
return null;
}
if( entry instanceof byte[] ) {
return null;
}
if (!(entry instanceof Document)) {
throw new DBException(FaultCodes.COL_INVALID_RESULT,
"Resource '" + key + "' in collection '" +
getCanonicalName() + "' is not a document");
}
return (Document) entry;
}
Re: Bug: Mixing binary and xml content in collection results to exceptions when doing an xquery - patch provided
Posted by Daniel Migowski <Mi...@artis.uni-oldenburg.de>.
Hello xindice-dev,
I will add this report to bugzilla myself, please don't care for this
mail anymore.
Greetings
Daniel