Bug 31974 - [patch] Mixing binary and xml content in collection results to exceptions when doing an xquery
Summary: [patch] Mixing binary and xml content in collection results to exceptions whe...
Status: CLOSED FIXED
Alias: None
Product: Xindice
Classification: Unclassified
Component: DB Engine (show other bugs)
Version: cvs head (1.1)
Hardware: All All
: P3 normal
Target Milestone: ---
Assignee: Xindice Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-10-29 20:54 UTC by Daniel Migowski
Modified: 2006-11-07 20:22 UTC (History)
0 users



Attachments
patch (695 bytes, patch)
2004-10-29 20:54 UTC, Daniel Migowski
Details | Diff
Small program to reproduce the error (5.74 KB, text/plain)
2004-10-29 20:56 UTC, Daniel Migowski
Details
Config for small program to replace the error (2.00 KB, text/plain)
2004-10-29 20:57 UTC, Daniel Migowski
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Migowski 2004-10-29 20:54:08 UTC
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.)
Comment 1 Daniel Migowski 2004-10-29 20:54:37 UTC
Created attachment 13265 [details]
patch
Comment 2 Daniel Migowski 2004-10-29 20:56:37 UTC
Created attachment 13266 [details]
Small program to reproduce the error
Comment 3 Daniel Migowski 2004-10-29 20:57:04 UTC
Created attachment 13267 [details]
Config for small program to replace the error
Comment 4 sheldon robinson 2006-10-04 22:19:10 UTC
Use this instead

        if (!(entry instanceof Document)) {
        	
            if (log.isErrorEnabled()) {
            log.error("Message",
            		new DBException(FaultCodes.COL_INVALID_RESULT,"Resource '" + key +
"' in collection '" + getCanonicalName() + "' is not a document"));
            }
            return null;
        }
Comment 5 Vadim Gritsenko 2006-11-07 20:14:48 UTC
Fixed. Collection.getDocument should throw exception if resource of incorrect
type, so fix was done at query resolver level.