From c872ba3108cc0d7b8dba2b183d98d3ff6bd2649b Mon Sep 17 00:00:00 2001 From: Philip Luppens Date: Sat, 8 Sep 2007 22:28:42 +0000 Subject: [PATCH] Missed JUnit test in last commit. Still having troubles to get the testcases to run normally. If this commit doesn't solve it, I might need some more time to fix this. git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@573919 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/struts2/dispatcher/ChartResult.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/plugins/jfreechart/src/main/java/org/apache/struts2/dispatcher/ChartResult.java b/plugins/jfreechart/src/main/java/org/apache/struts2/dispatcher/ChartResult.java index e273104ae..27cf6f907 100644 --- a/plugins/jfreechart/src/main/java/org/apache/struts2/dispatcher/ChartResult.java +++ b/plugins/jfreechart/src/main/java/org/apache/struts2/dispatcher/ChartResult.java @@ -153,6 +153,14 @@ public class ChartResult implements Result { this.value = value; } + public JFreeChart getChart() { + return chart; + } + + public void setChart(JFreeChart chart) { + this.chart = chart; + } + // OTHER METHODS ----------------------- // Required by com.opensymphony.xwork2.Result @@ -164,7 +172,8 @@ public class ChartResult implements Result { * @throws Exception if an error occurs when creating or writing the chart to the servlet output stream. */ public void execute(ActionInvocation invocation) throws Exception { - chart = (JFreeChart) invocation.getStack().findValue(value, JFreeChart.class); + if (chart == null) + chart = (JFreeChart) invocation.getStack().findValue(value, JFreeChart.class); if (chart == null) // we need to have a chart object - if not, blow up throw new NullPointerException("No JFreeChart object found on the stack with name " + value); // make sure we have some value for the width and height