Vadim Gritsenko wrote:
Well I can see that in dev environment you would prefer to get error
right away, but historically i18n was allowing content editors to push
broken XML files and site admins to scream on editors, while all other
users can continue to use older version of a site.
Ah, I see the reason now, even if I disagree with the process :-)
It's better to ensure that files are well-formed before deploying them!
<snip/>
SNFE is used here as a substitute for source.exist(), probably
because two implementations don't have a proper implementation for
it. Better fix the implementations or log the exception only if
source.exists() returns true rather than fill the logs with
meaningless exceptions.
Won't argue with that. OTOH, there might be broken sources out there
where even if source.exists() it can still throw SNFE.
You also have to take into an account a situation where source WAS
existing at the moment of .exists(), but was removed before you
tried to .getInputStream() it. So, SNFE handling still has to be
present.
Ok, so what about :
catch (SNFE snfe) {
if (!source.exists()) {
getLogger.info("bundle " + source.getURI() + " doesn't exist");
} else {
getLogger.info("bundle " + source.getURI() + " is said to
exist but could not be loaded", sfne);
}
}
That way, we avoid logging an exception that just says that the
source doesn't exist, but still log it whenever there is an
inconsistency between exists() and getInputStream(), whatever its cause.
Deal?
No objections to this one.
Ok, I'll do it.
Sylvain
--
Sylvain Wallez Anyware Technologies
http://people.apache.org/~sylvain http://www.anyware-tech.com
Apache Software Foundation Member Research & Technology Director