You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ambari.apache.org by Jonathan Hurley <jh...@hortonworks.com> on 2015/05/31 15:38:11 UTC

Review Request 34857: Alert Definition Source Field Has Numerical Values Converted To Strings On Creation Or Update

-----------------------------------------------------------
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


Re: Review Request 34857: Alert Definition Source Field Has Numerical Values Converted To Strings On Creation Or Update

Posted by Tom Beerbower <tb...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/34857/#review85904
-----------------------------------------------------------

Ship it!


Ship It!

- Tom Beerbower


On May 31, 2015, 1:38 p.m., Jonathan Hurley wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/34857/
> -----------------------------------------------------------
> 
> (Updated May 31, 2015, 1:38 p.m.)
> 
> 
> 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
> 
>