diff --git a/wise-webapp/src/main/java/com/wisemapping/controller/ExportController.java b/wise-webapp/src/main/java/com/wisemapping/controller/ExportController.java index dc51bd8e..bbff318f 100644 --- a/wise-webapp/src/main/java/com/wisemapping/controller/ExportController.java +++ b/wise-webapp/src/main/java/com/wisemapping/controller/ExportController.java @@ -150,6 +150,7 @@ public class ExportController extends BaseMultiActionController { exportImage(response, mapSvg, bos, false); } catch (Throwable e) { logger.error("Unexpexted error generating the image", e); + logger.error("map: "+mapSvg); } BASE64Encoder encoder = new BASE64Encoder(); @@ -164,11 +165,11 @@ public class ExportController extends BaseMultiActionController { } public ModelAndView image(HttpServletRequest request, HttpServletResponse response) throws TranscoderException, IOException, JAXBException { - try { - logger.info("Export Controller: generating image WiseMap action"); + logger.info("Export Controller: generating image WiseMap action"); - final String mapIdStr = request.getParameter(MAP_ID_PARAMETER); - final String mapSvg = request.getParameter(MAP_SVG_PARAMETER); + final String mapIdStr = request.getParameter(MAP_ID_PARAMETER); + final String mapSvg = request.getParameter(MAP_SVG_PARAMETER); + try { final ServletOutputStream outputStream = response.getOutputStream(); exportImage(response, mapSvg, outputStream, true); @@ -176,6 +177,7 @@ public class ExportController extends BaseMultiActionController { } catch (Throwable e) { logger.error("Unexpexted error generating the image", e); + logger.error("map: "+mapSvg); } return null; } diff --git a/wise-webapp/src/main/java/com/wisemapping/exporter/ExporterFactory.java b/wise-webapp/src/main/java/com/wisemapping/exporter/ExporterFactory.java index fdb0302d..5372e41d 100644 --- a/wise-webapp/src/main/java/com/wisemapping/exporter/ExporterFactory.java +++ b/wise-webapp/src/main/java/com/wisemapping/exporter/ExporterFactory.java @@ -131,17 +131,27 @@ public class ExporterFactory { } } - private static Document normalizeSvg(String svgXml, final String imgBaseUrl) throws XMLStreamException, ParserConfigurationException, IOException, SAXException, TransformerException { + private static Document normalizeSvg(@NotNull String svgXml, final String imgBaseUrl) throws XMLStreamException, ParserConfigurationException, IOException, SAXException, TransformerException { final DocumentBuilder documentBuilder = getDocumentBuilder(); svgXml = svgXml.replaceFirst("]+)>", ""); + + final Reader in = new CharArrayReader(svgXml.toCharArray()); + final InputSource is = new InputSource(in); + document = documentBuilder.parse(is); + } - final Document document = documentBuilder.parse(is); fitSvg(document); @@ -191,7 +201,7 @@ public class ExporterFactory { // find all groups if (GROUP_NODE_NAME.equals(node.getNodeName())) { // Must continue looking .... - fixImageTagHref(document,(Element) node, imgBaseUrl); + fixImageTagHref(document, (Element) node, imgBaseUrl); } else if (IMAGE_NODE_NAME.equals(node.getNodeName())) { @@ -290,34 +300,4 @@ public class ExporterFactory { return transate.split(","); } -// @NotNull -// static private String convertBrowserSvgToXmlSvg(@NotNull String mapSvg) -// throws IOException, JAXBException, SAXException, TransformerException { -// String buff = "\n" + mapSvg; -// -// // Add namespace... -// buff = buff.replaceFirst("]+)>", ""); - result = result.replaceAll("]+)//+>", ""); - return result.toCharArray(); -======= -*/ \ No newline at end of file diff --git a/wise-webapp/src/main/webapp/jsp/mindmapList.jsp b/wise-webapp/src/main/webapp/jsp/mindmapList.jsp index ec4ab39c..f0b9694e 100644 --- a/wise-webapp/src/main/webapp/jsp/mindmapList.jsp +++ b/wise-webapp/src/main/webapp/jsp/mindmapList.jsp @@ -220,9 +220,9 @@ rel="moodalbox 600px 400px" title=""> --%> - + <%-- - + --%> diff --git a/wise-webapp/src/test/data/svg/map5.png b/wise-webapp/src/test/data/svg/map5.png new file mode 100644 index 00000000..e69de29b diff --git a/wise-webapp/src/test/data/svg/map5.svg b/wise-webapp/src/test/data/svg/map5.svg new file mode 100644 index 00000000..74b77730 --- /dev/null +++ b/wise-webapp/src/test/data/svg/map5.svg @@ -0,0 +1,33 @@ + + + + + + t + + + + + + Main Topic + + + + + + + \ No newline at end of file