-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/34857/
-----------------------------------------------------------

Review request for Ambari, Nate Cole and Tom Beerbower.


Bugs: AMBARI-11566
    https://issues.apache.org/jira/browse/AMBARI-11566


Repository: ambari


Description
-------

When creating or updating an alert definition from the API, any numerical 
values in the {{source}} element are converted into {{String}} and stored in 
the database as such. This causes de-serialization problems for definitions on 
Ambari Server restart.

The problem stems from how Ambari converts the JSON body to a Map inside of 
{{JsonRequestBodyParser}}. This uses a {{Map<String,String>}} instead of a 
{{Map<String,Object>}}. As a result, the {{JsonObject}} has it's {{asText()}} 
method used to retrieve the value.

The fix here, localized to the AlertResourceProvider, seemed a lot safer than 
trying to change the core JSON processor to use a Map<String,Object>


Diffs
-----

  
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertDefinitionResourceProvider.java
 24fb931 
  
ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AlertDefinitionResourceProviderTest.java
 75185ba 

Diff: https://reviews.apache.org/r/34857/diff/


Testing
-------

Manually tested creating/updating definitions.

mvn clean test
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 28:20 min
[INFO] Finished at: 2015-05-30T17:25:06-04:00
[INFO] Final Memory: 33M/1309M
[INFO] ------------------------------------------------------------------------


Thanks,

Jonathan Hurley

Reply via email to