JAXB UnmarshalException - Filename containing #

SCENARIO
I am using JAXB 2.0 and I had a process that gets xml files from a web service that needs to be canceled. The names are provided by the webservice and with the format:

ESA08021701#99152015AA00024175#20150612#20150618125838_NOTIF_250073.xml

      

PROBLEM
When I try to unpack these files:

File file = // get my file from a list
unmarshaller.unmarshal(file);

      

I get this UnmarshalException

javax.xml.bind.UnmarshalException - with associated exception: [java.io. FileNotFoundException: ESA08021701 (The system cannot find the file specified.)] At javax.xml.bind.UnmarshalException. (UnmarshalException.java:56)

I pointed out that the filename is Exception

not complete ESA08021701

, but debugging. I can see the filename is correct and File

exists ...

Question
Is this a bug? AFAIK is #

n't a special character for filenames? How can I handle these files?

+3


source to share


1 answer


After researching the documentation and forums, I think this is still a problem JaxB

, but in the end I found a workaround FileInputStream

for this that might be helpful to others:



File file = // get my file from a list
Object unmarshalled = unmarshaller.unmarshal(new FileInputStream(myFile));

      

+3


source







All Articles