Commits

Sebastian Sdorra committed ac09cb9

use reader instead of xmlsource to read configuration entry stores

  • Participants
  • Parent commits 31aec2a
  • Branches issue-405

Comments (0)

Files changed (1)

File scm-dao-xml/src/main/java/sonia/scm/store/JAXBConfigurationEntryStore.java

  */
 
 
+
 package sonia.scm.store;
 
 //~--- non-JDK imports --------------------------------------------------------
 
+import com.google.common.base.Charsets;
 import com.google.common.base.Predicate;
 import com.google.common.collect.Collections2;
 import com.google.common.collect.Maps;
 //~--- JDK imports ------------------------------------------------------------
 
 import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.io.Reader;
+import java.io.Writer;
 
 import java.util.Collection;
 import java.util.Collections;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamWriter;
-import javax.xml.transform.stream.StreamSource;
 
 /**
  *
   }
 
   /**
+   * Method description
+   *
+   *
+   * @return
+   *
+   * @throws FileNotFoundException
+   */
+  private Reader createReader() throws FileNotFoundException
+  {
+    return new InputStreamReader(new FileInputStream(file), Charsets.UTF_8);
+  }
+
+  /**
+   * Method description
+   *
+   *
+   * @return
+   *
+   * @throws FileNotFoundException
+   */
+  private Writer createWriter() throws FileNotFoundException
+  {
+    return new OutputStreamWriter(new FileOutputStream(file), Charsets.UTF_8);
+  }
+
+  /**
    *   Method description
    *
    *
     {
       Unmarshaller u = context.createUnmarshaller();
 
-      reader = xmlInputFactory.createXMLStreamReader(new StreamSource(file));
+      reader = xmlInputFactory.createXMLStreamReader(createReader());
       reader.nextTag();
       reader.nextTag();
 
       //J-
       writer = new IndentXMLStreamWriter(
         XMLOutputFactory.newFactory().createXMLStreamWriter(
-          new FileOutputStream(file)
+          createWriter()
         )
       );
       //J+