How about we give the documents that are presently generating WARNings because they do not validate -- cannot be validated -- schemas so that they can be validated?

On Jan 9, 2008, at 3:16 PM, Drew Wills wrote:

Hey Everyone,

I have some changes I'd like to propose for the ResourceLoader class...

It appears that, since revision 36611, the 2-argument overload of the getResourceAsDocument() method has been validating XML resources as they are loaded. Before that revision, validation was off.

I'm not sure why validation became the default. Some JIRAs are referenced that describe issues around getting validation to work, but I don't see an explanation for why arbitrary XML resources ought to be validated in the first place. These JIRAs seem to be concerned with specific files -- not XML resources in general.

Here are the JIRAs for easy reference:
 - http://www.ja-sig.org/issues/browse/UP-1197
 - http://www.ja-sig.org/issues/browse/UP-1295
 - http://www.ja-sig.org/issues/browse/UP-1780

The issue is that some XML configuration docs normally included w/ uPortal don't have a schema or DTD, and therefore will always fail validation.

Andrew Petro committed a partial fix with revision 42275: first the method tries every document *with* validation, then it tries without for any document that fails. This change gets us to a portal that works, but it leaves us with huge, ugly stack traces in the logs.

Here's the code, for reference:

*****
try {
 // first try with validation turned on
 return getResourceAsDocument(requestingClass, resource, true);
} catch (Exception e) {

 if (log.isDebugEnabled()) {
log.debug("Problem getting resource [" + resource + "] as requested by class [" + requestingClass.getName() + "]", e);

 } else {
log.warn("Problem getting resource [" + resource + "] as requested by class [" + requestingClass.getName() + "]");

 }

 // try again with validation turned off
 return getResourceAsDocument(requestingClass, resource, false);
}
*****

I'm just not convinced we even need to try validation on an unknown, arbitrary XML doc. When we *know* the document can & should be validated, there's a 3-argument overload (referenced in the code above) that will validate when told to do so (boolean 3rd argument).

I'd like to replace the code above with the following simple approach:

*****
 return getResourceAsDocument(requestingClass, resource, false);
*****

This change would mean that the 2-argument overload goes back to not validating; for documents where validation is desirable, we can instead use the 3-argument version.

The code that's there now throws huge stack traces into the logs at the WARN level in situations where the portal is operating normally -- at a minimum I believe we should change that behavior. But as long as I'm looking into it, I think it's better just to change back to non-validating as the default.

Thoughts?

drew wills

--
Andrew Wills
UNICON, Inc.
Office:  (480) 558-2476
http://code.google.com/p/cernunnos/

--
You are currently subscribed to [email protected] as: [EMAIL 
PROTECTED]
To unsubscribe, change settings or access archives, see 
http://www.ja-sig.org/wiki/display/JSG/uportal-dev


--
You are currently subscribed to [email protected] as: [EMAIL 
PROTECTED]
To unsubscribe, change settings or access archives, see 
http://www.ja-sig.org/wiki/display/JSG/uportal-dev

Reply via email to