Bug 31974

Summary: [patch] Mixing binary and xml content in collection results to exceptions when doing an xquery
Product: Xindice Reporter: Daniel Migowski <apache>
Component: DB EngineAssignee: Xindice Developers <xindice-dev>
Status: CLOSED FIXED    
Severity: normal    
Priority: P3    
Version: cvs head (1.1)   
Target Milestone: ---   
Hardware: All   
OS: All   
Attachments: patch
Small program to reproduce the error
Config for small program to replace the error

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.