Author: hlship Date: Mon Aug 1 00:11:27 2011 New Revision: 1152666 URL: http://svn.apache.org/viewvc?rev=1152666&view=rev Log: TAP5-1421: Handle the case where all alerts are dismissed but no AlertStorage object yet exists
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Alerts.java Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Alerts.java URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Alerts.java?rev=1152666&r1=1152665&r2=1152666&view=diff ============================================================================== --- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Alerts.java (original) +++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Alerts.java Mon Aug 1 00:11:27 2011 @@ -81,12 +81,17 @@ public class Alerts implements ClientEle Object onDismiss(@RequestParameter(value = "id", allowBlank = true) Long alertId) { - if (alertId != null) + // If the alert was created inside an Ajax request and AlertStorage did not previously + // exist, it can be null when the dismiss event comes up from the client. + if (storage != null) { - storage.dismiss(alertId); - } else - { - storage.dismissAll(); + if (alertId != null) + { + storage.dismiss(alertId); + } else + { + storage.dismissAll(); + } } return new JSONObject();