You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shale.apache.org by cr...@apache.org on 2007/04/13 03:05:37 UTC
svn commit: r528299 - in /shale/framework/trunk/shale-dialog/src/main:
java/org/apache/shale/dialog/ resources/org/ resources/org/apache/
resources/org/apache/shale/ resources/org/apache/shale/dialog/
resources/org/apache/shale/dialog/resources/
Author: craigmcc
Date: Thu Apr 12 18:05:36 2007
New Revision: 528299
URL: http://svn.apache.org/viewvc?view=rev&rev=528299
Log:
[SHALE-432] Add an exception message if getDialogContextManager() cannot
locate a DialogContextManager instance. The most likely cause for this
scenario is that the developer forgot to include one of the implementation
JARs (shale-dialog-basic-xxx.jar or shale-dialog-scxml-xxx.jar) in their
application, so remind them about that.
Thanks to Matthias Wutke on the user mailing list for the suggestion.
Added:
shale/framework/trunk/shale-dialog/src/main/resources/org/
shale/framework/trunk/shale-dialog/src/main/resources/org/apache/
shale/framework/trunk/shale-dialog/src/main/resources/org/apache/shale/
shale/framework/trunk/shale-dialog/src/main/resources/org/apache/shale/dialog/
shale/framework/trunk/shale-dialog/src/main/resources/org/apache/shale/dialog/resources/
shale/framework/trunk/shale-dialog/src/main/resources/org/apache/shale/dialog/resources/Bundle.properties (with props)
Modified:
shale/framework/trunk/shale-dialog/src/main/java/org/apache/shale/dialog/DialogHelper.java
Modified: shale/framework/trunk/shale-dialog/src/main/java/org/apache/shale/dialog/DialogHelper.java
URL: http://svn.apache.org/viewvc/shale/framework/trunk/shale-dialog/src/main/java/org/apache/shale/dialog/DialogHelper.java?view=diff&rev=528299&r1=528298&r2=528299
==============================================================================
--- shale/framework/trunk/shale-dialog/src/main/java/org/apache/shale/dialog/DialogHelper.java (original)
+++ shale/framework/trunk/shale-dialog/src/main/java/org/apache/shale/dialog/DialogHelper.java Thu Apr 12 18:05:36 2007
@@ -17,6 +17,7 @@
package org.apache.shale.dialog;
+import java.util.ResourceBundle;
import javax.faces.context.FacesContext;
/**
@@ -36,6 +37,13 @@
}
/**
+ * <p>Resource bundle containing our localized messages.</p>
+ */
+ private static ResourceBundle bundle =
+ ResourceBundle.getBundle("org.apache.shale.dialog.resources.Bundle");
+
+
+ /**
* <p>Return the <code>data</code> property of the active
* {@link DialogContext} instance for the current request, if any;
* otherwise, return <code>null</code>.</p>
@@ -97,6 +105,10 @@
/**
* <p>Return the {@link DialogContextManager} instance for the current
* user, creating it first if necessary.</p>
+ *
+ * @exception IllegalStateException if no {@link DialogContextManager}
+ * instance could be found (probably because the developer forgot to
+ * include an implementation JAR)
*/
public static DialogContextManager getDialogContextManager() {
@@ -110,12 +122,19 @@
* user, creating it first if necessary.</p>
*
* @param context <code>FacesContext</code> for the current request
+ *
+ * @exception IllegalStateException if no {@link DialogContextManager}
+ * instance could be found (probably because the developer forgot to
+ * include an implementation JAR)
*/
public static DialogContextManager getDialogContextManager(FacesContext context) {
DialogContextManager manager = (DialogContextManager)
context.getApplication().getVariableResolver().
resolveVariable(context, Constants.MANAGER_BEAN);
+ if (manager == null) {
+ throw new IllegalStateException(bundle.getString("dialog.noDialogContextManager"));
+ }
return manager;
}
Added: shale/framework/trunk/shale-dialog/src/main/resources/org/apache/shale/dialog/resources/Bundle.properties
URL: http://svn.apache.org/viewvc/shale/framework/trunk/shale-dialog/src/main/resources/org/apache/shale/dialog/resources/Bundle.properties?view=auto&rev=528299
==============================================================================
--- shale/framework/trunk/shale-dialog/src/main/resources/org/apache/shale/dialog/resources/Bundle.properties (added)
+++ shale/framework/trunk/shale-dialog/src/main/resources/org/apache/shale/dialog/resources/Bundle.properties Thu Apr 12 18:05:36 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.
+
+dialog.noDialogContextManager=No DialogContextManager instance can be found. Did you include an implementation JAR (such as shale-dialog-basic-xxx.jar or shale-dialog-scxml-xxx.jar) in your WEB-INF/lib directory?
Propchange: shale/framework/trunk/shale-dialog/src/main/resources/org/apache/shale/dialog/resources/Bundle.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: shale/framework/trunk/shale-dialog/src/main/resources/org/apache/shale/dialog/resources/Bundle.properties
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL