dev@jaxb.java.net

unmarshal(File file) can't deal with "%" in file name.

From: Schudt, Christian <Christian.Schudt_at_cgm.com>
Date: Fri, 30 Jan 2015 13:14:30 +0000

Hi,

I think I've found a bug in JAXB RI:

I am using the Unmarshaller to unmarshal an XML file:

unmarshaller.unmarshal(xmlFile); // java.io.File object.

If the file path contains a "%" sign, I get the following stack trace (e.g. if the file is located at "C:\myfolder\d%\file.xml").

If I use unmarshaller.unmarshal(new FileInputStream(xmlFile)) instead, everything is fine.

Kind regards!

java.lang.IllegalArgumentException
                at sun.net.www.ParseUtil.decode(ParseUtil.java:202)
                at sun.net.www.protocol.file.Handler.openConnection(Handler.java:82)
                at sun.net.www.protocol.file.Handler.openConnection(Handler.java:72)
                at java.net.URL.openConnection(URL.java:972)
                at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:614)
                at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:189)
                at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:812)
                at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
                at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
                at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
                at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:649)
                at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:243)
                at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:214)
                at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:157)
                at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:162)
                at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:171)
                at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:189)