java - NUL characters after JAXB marshalling -


i've been using jaxb libraries read & write xml files while now, without issues. however, i've had issues nul characters written xml files during marshalling.

strange thing is, issue has cropped when testing on turkish version of windows. can't reproduce them on english or japanese (the platforms have access atm) distributions. idea causing this? example code below.

marshalling class:

public class inputsmarshaller {      public static inputs unmarshal(string filepath) {         inputs inputs = null;         try {             jaxbcontext context = jaxbcontext.newinstance(inputs.class); //1             unmarshaller unmarshaller = context.createunmarshaller();                 inputs = (inputs) unmarshaller.unmarshal(new file(filepath));         } catch (jaxbexception ex) {             ex.printstacktrace(system.out);         }             return inputs;     }      public static void marshal(inputs inputs, string filepath) {         try {             jaxbcontext context = jaxbcontext.newinstance(inputs.class); //1             marshaller marshaller = context.createmarshaller();             marshaller.setproperty(marshaller.jaxb_formatted_output, boolean.true);             marshaller.marshal(inputs, new filewriter(new file(filepath)));            } catch (ioexception | jaxbexception ex) {             ex.printstacktrace(system.out);         }             } } 

inputs class:

@xmlrootelement(name = "inputs") public class inputs {      private arraylist<string> values; private string name, unit;      @xmlelement(name="values")     public list<string> getvalues() {         if(values == null) {             values = new arraylist<>();         }         return values;     }  @xmlattribute(name = "name")     public void setname(string name) {         this.name = name;     }      public string getname() {         return name;     }  @xmlattribute(name = "unit")     public void setunit(string unit) {         this.unit = unit;     }      public string getunit() {         return unit;     } } 


Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -