incubator-adffaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From awi...@apache.org
Subject svn commit: r500060 - /incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/Service.java
Date Thu, 25 Jan 2007 23:47:20 GMT
Author: awiner
Date: Thu Jan 25 15:47:19 2007
New Revision: 500060

URL: http://svn.apache.org/viewvc?view=rev&rev=500060
Log:
Return a somewhat better error message from Service.getRenderKitService() if FacesContext.getRenderKit()
returns null.

Modified:
    incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/Service.java

Modified: incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/Service.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/Service.java?view=diff&rev=500060&r1=500059&r2=500060
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/Service.java
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/Service.java
Thu Jan 25 15:47:19 2007
@@ -19,6 +19,7 @@
 package org.apache.myfaces.trinidad.util;
 
 import javax.faces.context.FacesContext;
+import javax.faces.render.RenderKit;
 
 /**
  * <p>
@@ -106,6 +107,16 @@
   static public <T> T getRenderKitService(FacesContext context,
                                           Class<T> serviceClass)
   {
-    return getService(context.getRenderKit(), serviceClass);
+    // Provide a better exception than an NPE from inside of
+    // Service.getService().
+    RenderKit rk = context.getRenderKit();
+    if (rk == null)
+      throw new NullPointerException(
+        "FacesContext.getRenderKit() returned null while trying to "+
+        "get the " + serviceClass.getName() + " service;  please check " +
+        "your configuration.");
+ 
+
+    return getService(rk, serviceClass);
   }
 }



Mime
View raw message