diff --git a/experiment/src/org/labkey/experiment/DotGraph.java b/experiment/src/org/labkey/experiment/DotGraph.java index 5ef8aa766b0..a3ead269919 100644 --- a/experiment/src/org/labkey/experiment/DotGraph.java +++ b/experiment/src/org/labkey/experiment/DotGraph.java @@ -490,7 +490,7 @@ private String escape(String s) { return null; } - return s.replace("\"", "\\\"").replace("\n", " ").replace("\r", " "); + return s.replace("\\", "\\\\").replace("\"", "\\\"").replace("\n", " ").replace("\r", " "); } private class MNode extends DotNode diff --git a/experiment/src/org/labkey/experiment/ExperimentRunGraph.java b/experiment/src/org/labkey/experiment/ExperimentRunGraph.java index cf7a52cb2d0..2b4e81fc7f0 100644 --- a/experiment/src/org/labkey/experiment/ExperimentRunGraph.java +++ b/experiment/src/org/labkey/experiment/ExperimentRunGraph.java @@ -4,6 +4,7 @@ import org.graphper.api.Graphviz; import org.graphper.draw.ExecuteException; import org.graphper.parser.DotParser; +import org.graphper.parser.ParseException; import org.labkey.api.data.Container; import org.labkey.api.exp.ExperimentException; import org.labkey.api.exp.api.ExpData; @@ -48,22 +49,22 @@ public static void renderSvg(Writer out, Container c, ExpRunImpl run, boolean de private static String getSvg(String dot) throws ExecuteException { - Graphviz graph = DotParser.parse(dot); - - if (graph.isEmpty()) - return ""; // Graphviz.toSvgStr() throws an exception if the graph is empty. - try { + Graphviz graph = DotParser.parse(dot); + + if (graph.isEmpty()) + return ""; // Graphviz.toSvgStr() throws an exception if the graph is empty. + String svg = graph.toSvgStr(); // Scale down to 50% of default size. This is arbitrary but seems reasonable. Diagrams are larger than // the old image-based ones, but monitors are much higher resolution than when those were scaled. return SvgUtil.scaleSize(svg, 0.5f); } - catch (ExecuteException ex) + catch (ExecuteException | ParseException ex) { - LOG.warn("Error generating graph", ex); + LOG.error("Error generating graph", ex); throw ex; } } diff --git a/experiment/src/org/labkey/experiment/controllers/exp/experimentRunGraphView.jsp b/experiment/src/org/labkey/experiment/controllers/exp/experimentRunGraphView.jsp index 0f7917c4db0..d73391b29d6 100644 --- a/experiment/src/org/labkey/experiment/controllers/exp/experimentRunGraphView.jsp +++ b/experiment/src/org/labkey/experiment/controllers/exp/experimentRunGraphView.jsp @@ -15,7 +15,6 @@ * limitations under the License. */ %> -<%@ page import="org.graphper.draw.ExecuteException" %> <%@ page import="org.labkey.api.util.UniqueID" %> <%@ page import="org.labkey.api.view.HttpView" %> <%@ page import="org.labkey.api.view.template.ClientDependencies" %> @@ -67,7 +66,7 @@ model.getFocusType() ); } - catch (ExecuteException e) + catch (Exception e) { out.write("
Error rendering graph
"); }