Author: rahul
Date: Thu Feb  9 12:24:31 2006
New Revision: 376422

URL: http://svn.apache.org/viewcvs?rev=376422&view=rev
Log:
Throw an IAE if the ServletContext passed to the ServletContextResolver is 
null, since that will just result in an NPE down the road. Don't log error in 
similar situation in SessionContext, IAE should have the necessary information.


Modified:
    
jakarta/commons/sandbox/scxml/trunk/src/main/java/org/apache/commons/scxml/env/faces/SessionContext.java
    
jakarta/commons/sandbox/scxml/trunk/src/main/java/org/apache/commons/scxml/env/servlet/ServletContextResolver.java

Modified: 
jakarta/commons/sandbox/scxml/trunk/src/main/java/org/apache/commons/scxml/env/faces/SessionContext.java
URL: 
http://svn.apache.org/viewcvs/jakarta/commons/sandbox/scxml/trunk/src/main/java/org/apache/commons/scxml/env/faces/SessionContext.java?rev=376422&r1=376421&r2=376422&view=diff
==============================================================================
--- 
jakarta/commons/sandbox/scxml/trunk/src/main/java/org/apache/commons/scxml/env/faces/SessionContext.java
 (original)
+++ 
jakarta/commons/sandbox/scxml/trunk/src/main/java/org/apache/commons/scxml/env/faces/SessionContext.java
 Thu Feb  9 12:24:31 2006
@@ -60,7 +60,6 @@
     public SessionContext(final FacesContext fc, final Context parent) {
         super(parent);
         if (fc == null) {
-            LOG.error(ERR_HOST_FACES_CTX_NULL);
             throw new IllegalArgumentException(ERR_HOST_FACES_CTX_NULL);
         } else {
           // only retain the session map

Modified: 
jakarta/commons/sandbox/scxml/trunk/src/main/java/org/apache/commons/scxml/env/servlet/ServletContextResolver.java
URL: 
http://svn.apache.org/viewcvs/jakarta/commons/sandbox/scxml/trunk/src/main/java/org/apache/commons/scxml/env/servlet/ServletContextResolver.java?rev=376422&r1=376421&r2=376422&view=diff
==============================================================================
--- 
jakarta/commons/sandbox/scxml/trunk/src/main/java/org/apache/commons/scxml/env/servlet/ServletContextResolver.java
 (original)
+++ 
jakarta/commons/sandbox/scxml/trunk/src/main/java/org/apache/commons/scxml/env/servlet/ServletContextResolver.java
 Thu Feb  9 12:24:31 2006
@@ -28,6 +28,12 @@
  */
 public class ServletContextResolver implements PathResolver {
 
+    /** Cannot accept a null ServletContext, it will just throw
+     *  NullPointerException down the road. */
+    private static final String ERR_SERVLET_CTX_NULL =
+        "ServletContextResolver cannot be instantiated with a null"
+        + " ServletContext";
+
     /** The SevletContext we will use to resolve paths. */
     private ServletContext ctx = null;
 
@@ -37,6 +43,9 @@
      * @param ctx The ServletContext instance for this web application.
      */
     public ServletContextResolver(final ServletContext ctx) {
+        if (ctx == null) {
+            throw new IllegalArgumentException(ERR_SERVLET_CTX_NULL);
+        }
         this.ctx = ctx;
     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to