diff --git a/diylc/diylc-core/src/org/diylc/presenter/update.xml b/diylc/diylc-core/src/org/diylc/presenter/update.xml index f8dd09d4..650876ed 100644 --- a/diylc/diylc-core/src/org/diylc/presenter/update.xml +++ b/diylc/diylc-core/src/org/diylc/presenter/update.xml @@ -4188,7 +4188,7 @@ NEW_FEATURE - Added Project Explorer pane in the right-hand side for quick access to components + Added 'Project Explorer' pane in the right-hand side for quick access to components NEW_FEATURE diff --git a/diylc/diylc-core/src/org/diylc/serialization/ProjectFileManager.java b/diylc/diylc-core/src/org/diylc/serialization/ProjectFileManager.java index 941b3a7c..d76e75ea 100644 --- a/diylc/diylc-core/src/org/diylc/serialization/ProjectFileManager.java +++ b/diylc/diylc-core/src/org/diylc/serialization/ProjectFileManager.java @@ -31,8 +31,6 @@ import java.io.OutputStreamWriter; import java.io.Reader; import java.io.Writer; import java.lang.reflect.Modifier; -import java.nio.file.Files; -import java.nio.file.Paths; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; @@ -263,27 +261,24 @@ public class ProjectFileManager { } catch (Exception e) { warnings.add("Could not read file version number, the file may be corrupted."); } - - String xml = new String(Files.readAllBytes(Paths.get(fileName))); + FileInputStream fis = new FileInputStream(fileName); missingFields.clear(); - try { - xml = cleanupV3XML(xml); - project = (Project) xStream.fromXML(xml); + try { + Reader reader = new InputStreamReader(fis, "UTF-8"); + project = (Project) xStream.fromXML(reader); } catch (Exception e) { LOG.warn("Could not open with the new xStream, trying the old one", e); - project = (Project) xStreamOld.fromXML(xml); + fis.close(); + fis = new FileInputStream(fileName); + project = (Project) xStreamOld.fromXML(fis); } if (!missingFields.isEmpty()) { LOG.warn("The opened file is missing the following properties: " + String.join(", ", missingFields)); warnings.add("The project references unknown component properties, most likely because it was created with a newer version of DIYLC."); } + fis.close(); return project; } - - private String cleanupV3XML(String xml) { - xml = xml.replaceAll("", ""); - return xml; - } private VersionNumber readV3Version(String fileName) throws Exception { File fXmlFile = new File(fileName);