adding debug messages
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
@@ -86,13 +86,16 @@ public class Util {
|
|||||||
var end = matcher.end(0);
|
var end = matcher.end(0);
|
||||||
|
|
||||||
var umlHash = uml.hashCode();
|
var umlHash = uml.hashCode();
|
||||||
|
LOG.log(DEBUG,"Hash of Plantuml code: {0}",umlHash);
|
||||||
var svg = umlCache.get(umlHash);
|
var svg = umlCache.get(umlHash);
|
||||||
if (svg != null){
|
if (svg != null){
|
||||||
|
LOG.log(DEBUG,"Serving Plantuml generated SVG from cache…");
|
||||||
source = source.substring(0, start) + svg + source.substring(end);
|
source = source.substring(0, start) + svg + source.substring(end);
|
||||||
matcher = UML_PATTERN.matcher(source);
|
matcher = UML_PATTERN.matcher(source);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LOG.log(DEBUG,"Cache miss. Generating SVG from plantuml code…");
|
||||||
ProcessBuilder processBuilder = new ProcessBuilder("java", "-jar", plantumlJar.getAbsolutePath(), "-tsvg", "-pipe");
|
ProcessBuilder processBuilder = new ProcessBuilder("java", "-jar", plantumlJar.getAbsolutePath(), "-tsvg", "-pipe");
|
||||||
var ignored = processBuilder.redirectErrorStream();
|
var ignored = processBuilder.redirectErrorStream();
|
||||||
var process = processBuilder.start();
|
var process = processBuilder.start();
|
||||||
@@ -103,6 +106,7 @@ public class Util {
|
|||||||
|
|
||||||
try (InputStream is = process.getInputStream()) {
|
try (InputStream is = process.getInputStream()) {
|
||||||
byte[] out = is.readAllBytes();
|
byte[] out = is.readAllBytes();
|
||||||
|
LOG.log(DEBUG,"Generated SVG. Pushing to cache…");
|
||||||
svg = new String(out, UTF_8);
|
svg = new String(out, UTF_8);
|
||||||
umlCache.put(umlHash,svg);
|
umlCache.put(umlHash,svg);
|
||||||
source = source.substring(0, start) + svg + source.substring(end);
|
source = source.substring(0, start) + svg + source.substring(end);
|
||||||
|
|||||||
Reference in New Issue
Block a user