JDK-8157311 : FileNotFoundException from Unmarshaller.unmarshal(File f), if f contains #
  • Type: Bug
  • Component: xml
  • Sub-Component: jaxb
  • Affected Version: 8,9
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2016-05-06
  • Updated: 2017-01-03
  • Resolved: 2017-01-03
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9Fixed
Related Reports
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.8.0_66"
Java(TM) SE Runtime Environment (build 1.8.0_66-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.66-b17, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]

A DESCRIPTION OF THE PROBLEM :
unmarshaller.unmarshal(new File("C:\SomeDir#\Foo.xml")) fails with FileNotFoundException even, if the file exists. Seems that javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal( File f ) does not properly url-escape the path, when converting the file object to the url.

There was already an discussion about this issue in 2009, but it seems that no bug was filed.

See: https://community.oracle.com/thread/1626574?start=0&tstart=0


REPRODUCIBILITY :
This bug can be reproduced always.

CUSTOMER SUBMITTED WORKAROUND :
Construct a FileInpuStream from File and call unmarshal( java.io.InputStream is )


Comments
Attached test case executed on following JDK versions in Windows 7 and Linux environments: JDK 8 - Fail JDK 8u92 - Fail JDK 9ea - Fail
19-05-2016