Author: craigmcc Date: Thu Apr 12 18:19:19 2007 New Revision: 528303 URL: http://svn.apache.org/viewvc?view=rev&rev=528303 Log: [SHALE-432] Add a helpful error message if no configured dialog information can be found in application scope. This is most likely because the embedded servlet context listener that performs our configuration was not processed by our servlet container.
Added: shale/framework/trunk/shale-dialog-basic/src/main/resources/org/apache/shale/dialog/basic/ shale/framework/trunk/shale-dialog-basic/src/main/resources/org/apache/shale/dialog/basic/resources/ shale/framework/trunk/shale-dialog-basic/src/main/resources/org/apache/shale/dialog/basic/resources/Bundle.properties (with props) Modified: shale/framework/trunk/shale-dialog-basic/src/main/java/org/apache/shale/dialog/basic/BasicDialogManager.java Modified: shale/framework/trunk/shale-dialog-basic/src/main/java/org/apache/shale/dialog/basic/BasicDialogManager.java URL: http://svn.apache.org/viewvc/shale/framework/trunk/shale-dialog-basic/src/main/java/org/apache/shale/dialog/basic/BasicDialogManager.java?view=diff&rev=528303&r1=528302&r2=528303 ============================================================================== --- shale/framework/trunk/shale-dialog-basic/src/main/java/org/apache/shale/dialog/basic/BasicDialogManager.java (original) +++ shale/framework/trunk/shale-dialog-basic/src/main/java/org/apache/shale/dialog/basic/BasicDialogManager.java Thu Apr 12 18:19:19 2007 @@ -20,6 +20,7 @@ import java.io.Serializable; import java.util.HashMap; import java.util.Map; +import java.util.ResourceBundle; import javax.faces.context.FacesContext; @@ -51,6 +52,14 @@ /** + * <p>Resource bundle containing our localized messages.</p> + */ + private static final ResourceBundle bundle = + ResourceBundle.getBundle("org.apache.shale.dialog.basic.resources.Bundle"); + + + + /** * <p><code>Map</code> of [EMAIL PROTECTED] Dialog} configurations, keyed * by dialog name. This value is lazily instantiated, and is also * transient and may need to be regenerated.</p> @@ -151,6 +160,9 @@ * * @param context FacesContext for the current request * @return The map of available dialogs, keyed by dialog logical name + * + * @exception IllegalStateException if no configured [EMAIL PROTECTED] Dialog} + * information exists (probably because the startup listener did not run) */ private Map dialogs(FacesContext context) { @@ -162,6 +174,9 @@ // Return the previously configured application scope instance (if any) this.dialogs = (Map) context.getExternalContext().getApplicationMap().get(Globals.DIALOGS); + if (this.dialogs == null) { + throw new IllegalStateException(bundle.getString("basic.noDialogsMap")); + } return this.dialogs; } Added: shale/framework/trunk/shale-dialog-basic/src/main/resources/org/apache/shale/dialog/basic/resources/Bundle.properties URL: http://svn.apache.org/viewvc/shale/framework/trunk/shale-dialog-basic/src/main/resources/org/apache/shale/dialog/basic/resources/Bundle.properties?view=auto&rev=528303 ============================================================================== --- shale/framework/trunk/shale-dialog-basic/src/main/resources/org/apache/shale/dialog/basic/resources/Bundle.properties (added) +++ shale/framework/trunk/shale-dialog-basic/src/main/resources/org/apache/shale/dialog/basic/resources/Bundle.properties Thu Apr 12 18:19:19 2007 @@ -0,0 +1,16 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to you under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +basic.noDialogsMap=Startup configuration files were not processed. Be sure you are using a servlet container that recognizes listener declartaions, even inside a TLD that is embedded in a JAR file. Propchange: shale/framework/trunk/shale-dialog-basic/src/main/resources/org/apache/shale/dialog/basic/resources/Bundle.properties ------------------------------------------------------------------------------ svn:eol-style = native Propchange: shale/framework/trunk/shale-dialog-basic/src/main/resources/org/apache/shale/dialog/basic/resources/Bundle.properties ------------------------------------------------------------------------------ svn:keywords = Date Author Id Revision HeadURL