Summary: | Parser get confused when using external entities. | ||
---|---|---|---|
Product: | Log4j - Now in Jira | Reporter: | Juan David Zuluaga Arboleda <jzulu2000> |
Component: | Other | Assignee: | log4j-dev <log4j-dev> |
Status: | RESOLVED FIXED | ||
Severity: | blocker | CC: | log4j-dev |
Priority: | P3 | ||
Version: | 1.2 | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | Windows XP |
Description
Juan David Zuluaga Arboleda
2003-10-09 18:43:09 UTC
1.2.12 candidate Is there a "simple" fix that can be applied for this? I'll take this one. I fixed a similar issue with the JoranConfigurator. The problem is that the call to the parser used an InputStream (just a series of bytes) instead of an InputSource, URL or a File which would provide both the sequence of bytes and a base for resolving relative URL's. The problem had been fixed as part of the Joran development on the CVS HEAD, but there were no tests for it. The fix for this bug added DOMTest::test4 to both the CVS HEAD and v1.2_branch to check for the proper handling of external entities. The fix on the v1.2 branch is mimicked the approach in the Joran configuration by introducing a delegate that is called to actually perform the parsing. The original approach was to create an InputSource. Since there is no clean way prior to create a URL for an arbitrary file prior to JDK 1.4, the InputSource would not have a valid URL and attempts to resolve entities relative to the InputSource would fail. Using the delegate, the parser can be passed a File which it knows how to use to resolve relative URL's. The change should not change any successful call to DOMConfigurator. For most error conditions, the change should only result in improved diagnostic messages since the parser now knows more about the source and has more robust error reporting code than we had. If there are multiple error conditions, the change may affect which one gets reported. For example, if there is no XML parser available and the configuration file does not exist, the original code will report the missing file and the new code will report the missing parser. |