Commons Digester
  1. Commons Digester
  2. DIGESTER-52

<!ENTITY directives not processed properly in Windows.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: Nightly Builds
    • Fix Version/s: None
    • Labels:
      None
    • Environment:

      Operating System: Windows XP
      Platform: PC

      Description

      Try including an xml fragment using the <!ENTITY directive . On Windows you'll
      get a very uninformative exception.

      The reason is:
      org.apache.commons.digester.Digester.parse(File) incorrectly constructs file://
      URLs. On Windows, the file located at c:\foo.txt should be referred to as
      file:///c:/foo.txt NOT file://c:/foo.txt
      The best way to fix this is to change the line
      input.setSystemId("file://" + file.getAbsolutePath());
      to
      input.setSystemId(file.toURL().toString());

        Activity

        Hide
        Simon Kitching added a comment -

        Yep, the suggested code looks much better; parse(File) method has been updated.
        Thanks for the fix.

        Show
        Simon Kitching added a comment - Yep, the suggested code looks much better; parse(File) method has been updated. Thanks for the fix.

          People

          • Assignee:
            Unassigned
            Reporter:
            John Taylor
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development