dev@jaxb.java.net

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

From: Iaroslav Savytskyi <Iaroslav.Savytskyi_at_oracle.com>
Date: Thu, 5 Feb 2015 13:49:48 +0100

Hi Christian,

Thank you for reporting.

It’s looks like it’s not JAXB bug. But I’ll fire one agains JAXB API. So we will be able to fix this or propagate it to underground projects.


Yarda

> On 30 Jan 2015, at 14:14, Schudt, Christian <Christian.Schudt_at_cgm.com> wrote:
>
> 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)
>