From 936dae2209f22eac30e093a85ba8ce35072695b7 Mon Sep 17 00:00:00 2001 From: Paulo Veiga Date: Fri, 14 Sep 2018 23:16:35 -0700 Subject: [PATCH 1/6] Bump up version --- core-js/pom.xml | 2 +- mindplot/pom.xml | 2 +- pom.xml | 4 ++-- web2d/pom.xml | 2 +- wise-editor/pom.xml | 2 +- wise-webapp/pom.xml | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/core-js/pom.xml b/core-js/pom.xml index 05076de6..a64965bf 100644 --- a/core-js/pom.xml +++ b/core-js/pom.xml @@ -9,7 +9,7 @@ org.wisemapping wisemapping ../pom.xml - 4.0.3-SNAPSHOT + 4.0.5-SNAPSHOT scm:git:git@bitbucket.org:wisemapping/wisemapping-open-source.git diff --git a/mindplot/pom.xml b/mindplot/pom.xml index ae777c5b..137b3e8d 100644 --- a/mindplot/pom.xml +++ b/mindplot/pom.xml @@ -9,7 +9,7 @@ org.wisemapping wisemapping ../pom.xml - 4.0.3-SNAPSHOT + 4.0.5-SNAPSHOT diff --git a/pom.xml b/pom.xml index bb24c32d..09c0b704 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd"> - 4.0.3-SNAPSHOT + 4.0.5-SNAPSHOT ${project.basedir}/wise-webapps @@ -16,7 +16,7 @@ org.wisemapping wisemapping WiseMapping Project - 4.0.3-SNAPSHOT + 4.0.5-SNAPSHOT pom diff --git a/web2d/pom.xml b/web2d/pom.xml index bc940ba7..732c81a6 100644 --- a/web2d/pom.xml +++ b/web2d/pom.xml @@ -9,7 +9,7 @@ org.wisemapping wisemapping ../pom.xml - 4.0.3-SNAPSHOT + 4.0.5-SNAPSHOT diff --git a/wise-editor/pom.xml b/wise-editor/pom.xml index 8bce716d..a1a1ec4a 100644 --- a/wise-editor/pom.xml +++ b/wise-editor/pom.xml @@ -9,7 +9,7 @@ org.wisemapping wisemapping ../pom.xml - 4.0.3-SNAPSHOT + 4.0.5-SNAPSHOT diff --git a/wise-webapp/pom.xml b/wise-webapp/pom.xml index 796efcab..cb8cefec 100644 --- a/wise-webapp/pom.xml +++ b/wise-webapp/pom.xml @@ -9,7 +9,7 @@ org.wisemapping wisemapping ../pom.xml - 4.0.3-SNAPSHOT + 4.0.5-SNAPSHOT From 146e84d790426c19ed832022c318cca5c223cdc7 Mon Sep 17 00:00:00 2001 From: Paulo Veiga Date: Sat, 15 Sep 2018 01:25:14 -0700 Subject: [PATCH 2/6] Fix bug on based URL generation --- wise-webapp/src/main/webapp/jsp/login.jsp | 4 ++-- wise-webapp/src/main/webapp/jsp/userForgotPassword.jsp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/wise-webapp/src/main/webapp/jsp/login.jsp b/wise-webapp/src/main/webapp/jsp/login.jsp index 63170ad5..6a02a8c8 100644 --- a/wise-webapp/src/main/webapp/jsp/login.jsp +++ b/wise-webapp/src/main/webapp/jsp/login.jsp @@ -21,7 +21,7 @@

-
@@ -49,7 +49,7 @@
- "> +
diff --git a/wise-webapp/src/main/webapp/jsp/userForgotPassword.jsp b/wise-webapp/src/main/webapp/jsp/userForgotPassword.jsp index d11c228e..eec3a155 100755 --- a/wise-webapp/src/main/webapp/jsp/userForgotPassword.jsp +++ b/wise-webapp/src/main/webapp/jsp/userForgotPassword.jsp @@ -23,7 +23,7 @@ " class="btn btn-primary" data-loading-text=""/> " class="btn" - onclick="window.location=''"/> + onclick="window.location='/c/maps/'"/>
From 752aff4e5f90f08e8c1d0167d1bf383a48c0414c Mon Sep 17 00:00:00 2001 From: Paulo Veiga Date: Sun, 16 Sep 2018 12:29:19 -0700 Subject: [PATCH 3/6] Fix several minor issues. --- README.md | 7 ++++++- wise-webapp/pom.xml | 1 + wise-webapp/src/main/webapp/jsp/userRegistration.jsp | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 48d834c0..2205aa10 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ The goal of this project is to provide a high quality product that can be deploy The following products must be installed: - * Java Development Kit 7 or higher ([http://www.oracle.com/technetwork/java/javase/downloads/index.html]) + * Java Development Kit 8 or higher ([http://www.oracle.com/technetwork/java/javase/downloads/index.html]) * Maven 3.x or higher ([http://maven.apache.org/]) ### Compiling @@ -49,6 +49,10 @@ To test the javascript frontend you then do: Now open a browser using the URL http://localhost:8000/wise-editor/src/main/webapp/ +## Maintenance + + + ## Members ### Founders @@ -70,3 +74,4 @@ Now open a browser using the URL http://localhost:8000/wise-editor/src/main/weba The source code is Licensed under the WiseMapping Open License, Version 1.0 (the “License”); You may obtain a copy of the License at: [https://wisemapping.atlassian.net/wiki/display/WS/License] + diff --git a/wise-webapp/pom.xml b/wise-webapp/pom.xml index cb8cefec..085379d9 100644 --- a/wise-webapp/pom.xml +++ b/wise-webapp/pom.xml @@ -576,6 +576,7 @@ false foo + true 9999 ${project.build.directory}/wisemapping.war automatic diff --git a/wise-webapp/src/main/webapp/jsp/userRegistration.jsp b/wise-webapp/src/main/webapp/jsp/userRegistration.jsp index e0014b04..da42343f 100644 --- a/wise-webapp/src/main/webapp/jsp/userRegistration.jsp +++ b/wise-webapp/src/main/webapp/jsp/userRegistration.jsp @@ -49,7 +49,7 @@
-

${requestScope.captcha}

+

${requestScope.captcha}

From b89a82760c8c321bb83af121fc31bdeaafa6fa30 Mon Sep 17 00:00:00 2001 From: Paulo Veiga Date: Sun, 16 Sep 2018 13:05:11 -0700 Subject: [PATCH 4/6] Update batik --- wise-webapp/pom.xml | 9 ++------- .../exporter/ExportProperties.java | 4 ++-- .../wisemapping/exporter/ExporterFactory.java | 19 ++++++++++--------- 3 files changed, 14 insertions(+), 18 deletions(-) diff --git a/wise-webapp/pom.xml b/wise-webapp/pom.xml index 085379d9..f8af1bf3 100644 --- a/wise-webapp/pom.xml +++ b/wise-webapp/pom.xml @@ -211,7 +211,7 @@ org.apache.xmlgraphics batik-transcoder - 1.9.1 + 1.10 compile @@ -223,13 +223,8 @@ org.apache.xmlgraphics batik-codec - 1.9.1 + 1.10 - - - - - javax javaee-api diff --git a/wise-webapp/src/main/java/com/wisemapping/exporter/ExportProperties.java b/wise-webapp/src/main/java/com/wisemapping/exporter/ExportProperties.java index 64f7ef35..4fb7488f 100644 --- a/wise-webapp/src/main/java/com/wisemapping/exporter/ExportProperties.java +++ b/wise-webapp/src/main/java/com/wisemapping/exporter/ExportProperties.java @@ -48,7 +48,7 @@ public class ExportProperties { this.version = version; } - static public class GenericProperties extends ExportProperties { + private static class GenericProperties extends ExportProperties { private GenericProperties(ExportFormat format) { super(format); } @@ -65,7 +65,7 @@ public class ExportProperties { this.size = size; } - public ImageProperties(ExportFormat format) { + ImageProperties(ExportFormat format) { super(format); } 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 a2ffd1f8..47fc820b 100644 --- a/wise-webapp/src/main/java/com/wisemapping/exporter/ExporterFactory.java +++ b/wise-webapp/src/main/java/com/wisemapping/exporter/ExporterFactory.java @@ -49,13 +49,14 @@ import javax.xml.transform.stream.StreamResult; import javax.xml.xpath.*; import java.awt.geom.AffineTransform; import java.io.*; +import java.nio.charset.StandardCharsets; import java.util.regex.Pattern; public class ExporterFactory { private static final String GROUP_NODE_NAME = "g"; private static final String IMAGE_NODE_NAME = "image"; - public static final int MANGING = 50; - public static final String UTF_8_CHARSET_NAME = "UTF-8"; + private static final int MANGING = 50; + private static final String UTF_8_CHARSET_NAME = "UTF-8"; private File baseImgDir; public ExporterFactory(@NotNull final ServletContext servletContext) throws ParserConfigurationException { @@ -82,16 +83,16 @@ public class ExporterFactory { final String svgString = normalizeSvg(mapSvg); final TranscoderInput input = new TranscoderInput(new CharArrayReader(svgString.toCharArray())); - TranscoderOutput trascoderOutput = new TranscoderOutput(output); + TranscoderOutput transcoderOutput = new TranscoderOutput(output); // Save the image. - transcoder.transcode(input, trascoderOutput); + transcoder.transcode(input, transcoderOutput); break; } case JPG: { // Create a JPEG transcoder final Transcoder transcoder = new JPEGTranscoder(); - transcoder.addTranscodingHint(JPEGTranscoder.KEY_QUALITY, new Float(.99)); + transcoder.addTranscodingHint(JPEGTranscoder.KEY_QUALITY, .99f); final ExportProperties.ImageProperties imageProperties = (ExportProperties.ImageProperties) properties; @@ -123,22 +124,22 @@ public class ExporterFactory { } case SVG: { final String svgString = normalizeSvg(mapSvg); - output.write(svgString.getBytes(UTF_8_CHARSET_NAME)); + output.write(svgString.getBytes(StandardCharsets.UTF_8)); break; } case TEXT: { final Exporter exporter = XSLTExporter.create(XSLTExporter.Type.TEXT); - exporter.export(xml.getBytes(UTF_8_CHARSET_NAME), output); + exporter.export(xml.getBytes(StandardCharsets.UTF_8), output); break; } case OPEN_OFFICE_WRITER: { final Exporter exporter = XSLTExporter.create(XSLTExporter.Type.OPEN_OFFICE); - exporter.export(xml.getBytes(UTF_8_CHARSET_NAME), output); + exporter.export(xml.getBytes(StandardCharsets.UTF_8), output); break; } case MICROSOFT_EXCEL: { final Exporter exporter = XSLTExporter.create(XSLTExporter.Type.MICROSOFT_EXCEL); - exporter.export(xml.getBytes(UTF_8_CHARSET_NAME), output); + exporter.export(xml.getBytes(StandardCharsets.UTF_8), output); break; } case FREEMIND: { From e1389236947841c7ef0cb7c55cb2f9372769a660 Mon Sep 17 00:00:00 2001 From: Paulo Veiga Date: Sun, 16 Sep 2018 18:06:47 -0700 Subject: [PATCH 5/6] Hack for workaround batik OOM --- .../wisemapping/exporter/ExporterFactory.java | 23 +++++++++++++++---- .../wisemapping/exporter/XSLTExporter.java | 4 +--- 2 files changed, 20 insertions(+), 7 deletions(-) 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 47fc820b..98859fe7 100644 --- a/wise-webapp/src/main/java/com/wisemapping/exporter/ExporterFactory.java +++ b/wise-webapp/src/main/java/com/wisemapping/exporter/ExporterFactory.java @@ -19,6 +19,7 @@ package com.wisemapping.exporter; import com.wisemapping.importer.VersionNumber; +import org.apache.batik.ext.awt.image.rendered.TileCache; import org.apache.batik.parser.AWTTransformProducer; import org.apache.batik.parser.ParseException; import org.apache.batik.parser.TransformListParser; @@ -53,6 +54,11 @@ import java.nio.charset.StandardCharsets; import java.util.regex.Pattern; public class ExporterFactory { + + static { + // Try to prevent OOM. + TileCache.setSize(0); + } private static final String GROUP_NODE_NAME = "g"; private static final String IMAGE_NODE_NAME = "image"; private static final int MANGING = 50; @@ -70,6 +76,7 @@ public class ExporterFactory { public void export(@NotNull ExportProperties properties, @Nullable String xml, @NotNull OutputStream output, @Nullable String mapSvg) throws ExportException, IOException, TranscoderException { final ExportFormat format = properties.getFormat(); + switch (format) { case PNG: { // Create a JPEG transcoder @@ -81,12 +88,14 @@ public class ExporterFactory { // Create the transcoder input. final String svgString = normalizeSvg(mapSvg); - final TranscoderInput input = new TranscoderInput(new CharArrayReader(svgString.toCharArray())); + final CharArrayReader reader = new CharArrayReader(svgString.toCharArray()); + final TranscoderInput input = new TranscoderInput(reader); TranscoderOutput transcoderOutput = new TranscoderOutput(output); // Save the image. transcoder.transcode(input, transcoderOutput); + reader.close(); break; } case JPG: { @@ -101,7 +110,9 @@ public class ExporterFactory { // Create the transcoder input. final String svgString = normalizeSvg(mapSvg); - final TranscoderInput input = new TranscoderInput(new CharArrayReader(svgString.toCharArray())); + CharArrayReader reader = new CharArrayReader(svgString.toCharArray()); + final TranscoderInput input = new TranscoderInput(reader); + reader.close(); TranscoderOutput trascoderOutput = new TranscoderOutput(output); @@ -115,9 +126,10 @@ public class ExporterFactory { // Create the transcoder input. final String svgString = normalizeSvg(mapSvg); - final TranscoderInput input = new TranscoderInput(new CharArrayReader(svgString.toCharArray())); + CharArrayReader reader = new CharArrayReader(svgString.toCharArray()); + final TranscoderInput input = new TranscoderInput(reader); TranscoderOutput trascoderOutput = new TranscoderOutput(output); - + reader.close(); // Save the image. transcoder.transcode(input, trascoderOutput); break; @@ -156,6 +168,9 @@ public class ExporterFactory { default: throw new UnsupportedOperationException("Export method not supported."); } + + output.flush(); + output.close(); } private String normalizeSvg(@NotNull String svgXml) throws ExportException { diff --git a/wise-webapp/src/main/java/com/wisemapping/exporter/XSLTExporter.java b/wise-webapp/src/main/java/com/wisemapping/exporter/XSLTExporter.java index e3388104..9180e9e8 100644 --- a/wise-webapp/src/main/java/com/wisemapping/exporter/XSLTExporter.java +++ b/wise-webapp/src/main/java/com/wisemapping/exporter/XSLTExporter.java @@ -41,9 +41,7 @@ public class XSLTExporter implements Exporter { final CharArrayReader reader = new CharArrayReader(mmos.toString("iso-8859-1").toCharArray()); final Source mmSource = new StreamSource(reader); transformer.transform(mmSource, new StreamResult(outputStream)); - } catch (TransformerException e) { - throw new ExportException(e); - } catch (UnsupportedEncodingException e) { + } catch (TransformerException | UnsupportedEncodingException e) { throw new ExportException(e); } From b324415c18ecf243849d5b9b8671ed139460cfeb Mon Sep 17 00:00:00 2001 From: Paulo Veiga Date: Sun, 16 Sep 2018 18:27:42 -0700 Subject: [PATCH 6/6] Fix test --- .../java/com/wisemapping/exporter/ExporterFactory.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) 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 98859fe7..a4c6ebb0 100644 --- a/wise-webapp/src/main/java/com/wisemapping/exporter/ExporterFactory.java +++ b/wise-webapp/src/main/java/com/wisemapping/exporter/ExporterFactory.java @@ -65,11 +65,11 @@ public class ExporterFactory { private static final String UTF_8_CHARSET_NAME = "UTF-8"; private File baseImgDir; - public ExporterFactory(@NotNull final ServletContext servletContext) throws ParserConfigurationException { + public ExporterFactory(@NotNull final ServletContext servletContext) { this.baseImgDir = new File(servletContext.getRealPath("/")); } - public ExporterFactory(@NotNull final File baseImgDir) throws ParserConfigurationException { + public ExporterFactory(@NotNull final File baseImgDir) { this.baseImgDir = baseImgDir; } @@ -112,12 +112,11 @@ public class ExporterFactory { final String svgString = normalizeSvg(mapSvg); CharArrayReader reader = new CharArrayReader(svgString.toCharArray()); final TranscoderInput input = new TranscoderInput(reader); - reader.close(); - TranscoderOutput trascoderOutput = new TranscoderOutput(output); // Save the image. transcoder.transcode(input, trascoderOutput); + reader.close(); break; } case PDF: { @@ -129,9 +128,9 @@ public class ExporterFactory { CharArrayReader reader = new CharArrayReader(svgString.toCharArray()); final TranscoderInput input = new TranscoderInput(reader); TranscoderOutput trascoderOutput = new TranscoderOutput(output); - reader.close(); // Save the image. transcoder.transcode(input, trascoderOutput); + reader.close(); break; } case SVG: {