diff --git a/.gitignore b/.gitignore index 88374d39..fe191ddb 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ wisemapping.log* */.DS_Store .DS_Store target +.idea diff --git a/wise-webapp/src/main/java/com/wisemapping/exporter/FreemindExporter.java b/wise-webapp/src/main/java/com/wisemapping/exporter/FreemindExporter.java index be7a7ae3..c9f4d5da 100755 --- a/wise-webapp/src/main/java/com/wisemapping/exporter/FreemindExporter.java +++ b/wise-webapp/src/main/java/com/wisemapping/exporter/FreemindExporter.java @@ -207,7 +207,8 @@ public class FreemindExporter htmlContent.append(""); DocumentBuilder db = getInstanceBuilder(); - Document document = db.parse(new ByteArrayInputStream(htmlContent.toString().getBytes())); + byte[] bytes = htmlContent.toString().getBytes("UTF-8"); + Document document = db.parse(new ByteArrayInputStream(bytes), "UTF-8"); richcontent.setHtml(document.getDocumentElement()); return richcontent; } diff --git a/wise-webapp/src/main/java/com/wisemapping/importer/freemind/FreemindImporter.java b/wise-webapp/src/main/java/com/wisemapping/importer/freemind/FreemindImporter.java index 6ec01216..cb531067 100755 --- a/wise-webapp/src/main/java/com/wisemapping/importer/freemind/FreemindImporter.java +++ b/wise-webapp/src/main/java/com/wisemapping/importer/freemind/FreemindImporter.java @@ -119,6 +119,12 @@ public class FreemindImporter final String version = freemindMap.getVersion(); if (version != null) { + + // Is freemind mindmap ? + if (version.charAt(0) != '0') { + throw new ImporterException("Mindmap is not a FreeMind document. Document type info " + version); + } + final VersionNumber mapVersion = new VersionNumber(version); if (SUPPORTED_FREEMIND_VERSION.isGreaterThan(mapVersion)) { throw new ImporterException("FreeMind version " + mapVersion.getVersion() + " is not supported."); @@ -408,7 +414,7 @@ public class FreemindImporter if (depth == 1) { final String side = freeChild.getPOSITION(); - x = x * (side!=null && POSITION_LEFT.equals(side) ? -1 : 1); + x = x * (side != null && POSITION_LEFT.equals(side) ? -1 : 1); } else { final Coord coord = Coord.parse(wiseParent.getPosition()); x = x * (coord.isOnLeftSide() ? -1 : 1); diff --git a/wise-webapp/src/test/resources/data/freemind/fonts.mm b/wise-webapp/src/test/resources/data/freemind/fonts.mm index c22274f3..25e29b73 100644 --- a/wise-webapp/src/test/resources/data/freemind/fonts.mm +++ b/wise-webapp/src/test/resources/data/freemind/fonts.mm @@ -1,4 +1,4 @@ - +