What steps will reproduce the problem?
1. Run the following unit test.
@Test
public void reuseTest() {
LineChart lc = new LineChart();
LineChart lc2 = new LineChart();
LineChart.Style reusable = new LineChart.Style(Type.DOT,
"#111111",9,9);
lc.setDotStyle(reusable);
lc2.setDotStyle(reusable);
lc.addValues(10, 1, 5, 4, 6);
lc2.addValues(10, 1, 5, 4, 6);
lc.addDots(new LineChart.Dot(15, "#121212"));
lc2.addDots(new LineChart.Dot(15, "#121212"));
Chart c = new Chart();
c.addElements(lc);
c.addElements(lc2);
String s = OFC.getInstance().prettyPrint(c, 4);
System.out.println("RENDERED CHART:" + s);
assert !s.contains("\"@reference\"");
}
2. You will see @reference in the output.
What is the expected output? What do you see instead?
The expected output is:
===========================================================
RENDERED CHART:{
"elements": [
{
"dot-style": {
"dot-size": 2,
"hallow": false,
"halo-size": 2,
"rotation": 90,
"sides": 2,
"type": null
},
"font-size": 10,
"on-show": {"type": ""},
"type": "line",
"values": [
10,
1,
5,
4,
6,
{
"colour": "#121212",
"value": 15
}
]
},
{
"dot-style": {
"dot-size": 2,
"hallow": false,
"halo-size": 2,
"rotation": 90,
"sides": 2,
"type": null
},
"font-size": 10,
"on-show": {"type": ""},
"type": "line",
"values": [
10,
1,
5,
4,
6,
{
"colour": "#121212",
"value": 15
}
]
}
],
"is_decimal_separator_comma": 0,
"is_fixed_num_decimals_forced": 0,
"is_thousand_separator_disabled": 0,
"num_decimals": 2
}
================================================
The error output is:
RENDERED CHART:{
"elements": [
{
"dot-style": {
"dot-size": 2,
"hallow": false,
"halo-size": 2,
"rotation": 90,
"sides": 2,
"type": null
},
"font-size": 10,
"on-show": {"type": ""},
"type": "line",
"values": [
10,
1,
5,
4,
6,
{
"colour": "#121212",
"value": 15
}
]
},
{
"dot-style": {"@reference":
"../../jofc2.model.elements.LineChart/dot-style"},
"font-size": 10,
"on-show": {"type": ""},
"type": "line",
"values": [
10,
1,
5,
4,
6,
{
"colour": "#121212",
"value": 15
}
]
}
],
"is_decimal_separator_comma": 0,
"is_fixed_num_decimals_forced": 0,
"is_thousand_separator_disabled": 0,
"num_decimals": 2
}
================================================
What version of the product are you using? On what operating system?
Trunk of JOFC2 (as of 5/9/2009, rev. 111)
Please provide any additional information below.
It would be great if we didn't need to create new instances of Styles to
use them (ie., reuse a single Style object). I fixed this in the code in
our project by not reusing instances of LineChart.Style, but people are
bound to make this mistake in the future. Hopefully this case documented
will save them some time.
Original issue reported on code.google.com by gretchie.moran@gmail.com on 9 Jun 2009 at 2:06
Original issue reported on code.google.com by
gretchie.moran@gmail.com
on 9 Jun 2009 at 2:06