Description of problem: FINE: Multi-resource Graph json: [{ "key": "HornetQ Queue "ims-null"","value" : ... Wed Mar 12 11:23:19 GMT-700 2014 WARNING: Globally uncaught exception com.google.gwt.core.client.JavaScriptException: (SyntaxError) stack: SyntaxError: Unexpected token i at Object.parse (native) at Function.e.extend.parseJSON (http://st11p01ad-rhq001:7080/coregui/js/jquery-1.7.2.min.js:2:10821) at new $drawJsniChart_1.MultiLineChartContext (<anonymous>:100558:94) at $drawJsniChart_1 (<anonymous>:100576:18) As you can see here, the quote isn't escaped properly Version-Release number of selected component (if applicable): 4.9 How reproducible: Always Steps to Reproduce: 1. Create a resource with a quote in the name 2. Try to graph as part of a group 3. See Actual results: exception, no graph
Not the correct escape characters but pretty close. See: http://stackoverflow.com/questions/3020094/how-should-i-escape-strings-in-json diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/inventory/groups/detail/monitoring/table/CompositeGroupD3GraphListView.java b index cd637ac..516f98e 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/inventory/groups/detail/monitoring/table/CompositeGroupD3GraphListView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/inventory/groups/detail/monitoring/table/CompositeGroupD3GraphListView.java @@ -378,7 +378,7 @@ public String getJsonMetrics() { for (MultiLineGraphData multiLineGraphData : measurementForEachResource) { if(null != multiLineGraphData.getMeasurementData() && multiLineGraphData.getMeasurementData().size() > 0){ sb.append("{ \"key\": \""); - sb.append(multiLineGraphData.getResourceName()); + sb.append(multiLineGraphData.getResourceNameEscaped()); sb.append("\",\"value\" : "); sb.append(produceInnerValuesArray(multiLineGraphData.getMeasurementData())); sb.append("},"); @@ -477,6 +477,10 @@ public String getResourceName() { return resourceName; } + public String getResourceNameEscaped() { + return resourceName.replace('"', '\''); + } + public int getResourceId() { return resourceId; }
97cc62c3caa1288dac023f4 (pull request #30 - https://github.com/rhq-project/rhq/pull/30)
Bulk close of items fixed in RHQ 4.12 If you think this is not solved, then please open a *new* BZ and link to this one.