1
0
mirror of https://github.com/octoleo/plantuml-server.git synced 2024-12-22 08:48:54 +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.FileFormat;
import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.NullOutputStream;
import net.sourceforge.plantuml.SourceStringReader;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.core.DiagramDescription;
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.PSystemError;
import net.sourceforge.plantuml.ErrorUml;
@ -108,12 +109,13 @@ class DiagramResponse {
if (StringUtils.isDiagramCacheable(uml)) {
addHeaderForCache(blockUml);
}
String map = reader.outputImage(new NullOutputStream(),
new FileFormatOption(FileFormat.PNG, false)).getDescription();
String[] mapLines = map.split("[\\r\\n]");
final Diagram diagram = blockUml.getDiagram();
ImageData map = diagram.exportDiagram(new NullOutputStream(), 0,
new FileFormatOption(FileFormat.PNG, false));
if (map.containsCMapData()) {
PrintWriter httpOut = response.getWriter();
for (int i = 2; (i + 1) < mapLines.length; i++) {
httpOut.print(mapLines[i]);
final String cmap = map.getCMapData("plantuml");
httpOut.print(cmap);
}
}