----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/29928/#review68433 -----------------------------------------------------------
Ship it! Ship It! - Jonathan Hurley On Jan. 16, 2015, 10:34 a.m., Yurii Shylov wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/29928/ > ----------------------------------------------------------- > > (Updated Jan. 16, 2015, 10:34 a.m.) > > > Review request for Ambari, Jonathan Hurley and Nate Cole. > > > Bugs: AMBARI-9152 > https://issues.apache.org/jira/browse/AMBARI-9152 > > > Repository: ambari > > > Description > ------- > > Git 275e898 (https://github.com/apache/ambari/commit/275e898) introduced the > following change: > > {code} > - normalizedMap.put(propKey, entry.getValue()); > + normalizedMap.put(propKey, entry.getValue().toString()); > {code} > > in {{AlertTargetResourceProvider}}. This causes a problem when there is a > JSON array in the structure of an AlertTarget, such as when creating: > > {code} > { > "AlertTarget": { > "name": "Administrators", > "description": "The Admins", > "notification_type": "EMAIL", > "global": true, > "properties":{ > "ambari.dispatch.credential.username":"ambari", > "ambari.dispatch.credential.password":"password", > "ambari.dispatch.recipients":["[email protected]"], > "mail.smtp.host":"repo.ambari.apache.org", > "mail.smtp.port":"25", > "mail.smtp.auth":"true", > "mail.smtp.starttls.enable":"false", > "mail.smtp.from":"[email protected]" > } > } > } > {code} > > When getting this target back, the target's {{ambari.dispatch.recipients}} is > malformed: > > {code} > "properties" : { > "mail.smtp.from" : "[email protected]", > "ambari.dispatch.credential.username" : "ambari", > "mail.smtp.host" : "repo.ambari.apache.org", > "mail.smtp.port" : "25", > "mail.smtp.auth" : "true", > "ambari.dispatch.credential.password" : "password", > "ambari.dispatch.recipients" : "[[email protected]]", > "mail.smtp.starttls.enable" : "false" > } > } > {code} > > This causes the following exception on dispatch: > {noformat} > SEVERE: Service AlertNoticeDispatchService [FAILED] has failed in the RUNNING > state. > com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: This is > not a JSON Array. > at com.google.gson.Gson.fromJson(Gson.java:806) > at com.google.gson.Gson.fromJson(Gson.java:761) > at com.google.gson.Gson.fromJson(Gson.java:710) > at com.google.gson.Gson.fromJson(Gson.java:682) > at > org.apache.ambari.server.state.services.AlertNoticeDispatchService.buildNotificationFromTarget(AlertNoticeDispatchService.java:392) > at > org.apache.ambari.server.state.services.AlertNoticeDispatchService.runOneIteration(AlertNoticeDispatchService.java:309) > at > com.google.common.util.concurrent.AbstractScheduledService$1$1.run(AbstractScheduledService.java:170) > at > java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439) > at > java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317) > at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150) > at > java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98) > at > java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:180) > at > java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:204) > at > java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) > at java.lang.Thread.run(Thread.java:695) > Caused by: java.lang.IllegalStateException: This is not a JSON Array. > at com.google.gson.JsonElement.getAsJsonArray(JsonElement.java:100) > at > org.apache.ambari.server.state.services.AlertNoticeDispatchService$AlertTargetPropertyDeserializer.deserialize(AlertNoticeDispatchService.java:599) > at > org.apache.ambari.server.state.services.AlertNoticeDispatchService$AlertTargetPropertyDeserializer.deserialize(AlertNoticeDispatchService.java:1) > at com.google.gson.TreeTypeAdapter.read(TreeTypeAdapter.java:58) > at com.google.gson.Gson.fromJson(Gson.java:795) > ... 15 more > {noformat} > > STR: > 1) Create an alert target with a list of recipients > 2) Trigger an alert > 3) Observe the exception and the malformed alert target > > > Diffs > ----- > > > ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertTargetResourceProvider.java > e0d9863 > > ambari-server/src/main/java/org/apache/ambari/server/notifications/NotificationDispatcher.java > ec4093f > > ambari-server/src/main/java/org/apache/ambari/server/notifications/dispatchers/EmailDispatcher.java > 67bd640 > > ambari-server/src/main/java/org/apache/ambari/server/notifications/dispatchers/SNMPDispatcher.java > 0ed919f > > ambari-server/src/test/java/org/apache/ambari/server/notifications/MockDispatcher.java > 94202ca > > ambari-server/src/test/java/org/apache/ambari/server/notifications/dispatchers/EmailDispatcherTest.java > 7522286 > > ambari-server/src/test/java/org/apache/ambari/server/notifications/dispatchers/SNMPDispatcherTest.java > ed222ed > > ambari-server/src/test/java/org/apache/ambari/server/state/services/AlertNoticeDispatchServiceTest.java > d5ab08e > > Diff: https://reviews.apache.org/r/29928/diff/ > > > Testing > ------- > > Results : > > Tests run: 2537, Failures: 0, Errors: 0, Skipped: 15 > > > Thanks, > > Yurii Shylov > >
