1
0
mirror of https://github.com/octoleo/plantuml-server.git synced 2024-11-11 07:10:57 +00:00

Fix "map" issue that was broken

This commit is contained in:
Arnaud Roques 2017-12-12 17:53:04 +01:00
parent a7b5a02b28
commit b9bb9c71c5

View File

@ -35,11 +35,12 @@ import javax.servlet.http.HttpServletRequest;
import net.sourceforge.plantuml.BlockUml; import net.sourceforge.plantuml.BlockUml;
import net.sourceforge.plantuml.FileFormat; import net.sourceforge.plantuml.FileFormat;
import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.NullOutputStream;
import net.sourceforge.plantuml.SourceStringReader; import net.sourceforge.plantuml.SourceStringReader;
import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.servlet.utility.NullOutputStream; import net.sourceforge.plantuml.core.ImageData;
import net.sourceforge.plantuml.version.Version; import net.sourceforge.plantuml.version.Version;
import net.sourceforge.plantuml.PSystemError; import net.sourceforge.plantuml.PSystemError;
import net.sourceforge.plantuml.ErrorUml; import net.sourceforge.plantuml.ErrorUml;
@ -108,12 +109,13 @@ class DiagramResponse {
if (StringUtils.isDiagramCacheable(uml)) { if (StringUtils.isDiagramCacheable(uml)) {
addHeaderForCache(blockUml); addHeaderForCache(blockUml);
} }
String map = reader.outputImage(new NullOutputStream(), final Diagram diagram = blockUml.getDiagram();
new FileFormatOption(FileFormat.PNG, false)).getDescription(); ImageData map = diagram.exportDiagram(new NullOutputStream(), 0,
String[] mapLines = map.split("[\\r\\n]"); new FileFormatOption(FileFormat.PNG, false));
if (map.containsCMapData()) {
PrintWriter httpOut = response.getWriter(); PrintWriter httpOut = response.getWriter();
for (int i = 2; (i + 1) < mapLines.length; i++) { final String cmap = map.getCMapData("plantuml");
httpOut.print(mapLines[i]); httpOut.print(cmap);
} }
} }