ambari-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jonathan Hurley" <jhur...@hortonworks.com>
Subject Review Request 34857: Alert Definition Source Field Has Numerical Values Converted To Strings On Creation Or Update
Date Sun, 31 May 2015 13:38:11 GMT

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


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message