dev@javaserverfaces.java.net

Re: [REVIEW] Findbugs fixes

From: Roger Kitain <Roger.Kitain_at_Sun.COM>
Date: Wed, 01 Jun 2005 09:45:32 -0400

Ryan Lubke wrote:

>
> << ADD DESCRIPTION HERE >>
>
>
> SECTION: Modified Files
> ----------------------------
> M build.properties.tomcat
> - updated property to use correct endorsed.dirs property
>
> M jsf-api/build.xml
> - pass java.endorsed.dirs property to unit tests
>
> M jsf-api/template-src/MethodExpressionMethodBindingAdapter.java
> - make MethodInfo field transient
>
> M jsf-api/test/javax/faces/mock/MockELContext.java
> M jsf-ri/src/com/sun/faces/el/ELContextImpl.java
> - updated based on EL API changes
>
> M jsf-ri/src/com/sun/faces/RIConstants.java
> - removed mutable fields
>
> M jsf-ri/src/com/sun/faces/config/ConfigureListener.java
> - Replaced direct modifications to mutable fields in RIConstants with
> new calls to Util.
> - Replaced catch of Exception with more specific exception type
>
> M jsf-ri/src/com/sun/faces/context/ExternalContextImpl.java
> - Replaced direct modifications to mutable fields in RIConstants with
> new calls to Util.
>
> M jsf-ri/src/com/sun/faces/el/ELConstants.java
> - removed exposed IMPLICIT_OBJECTS array since
> the values of the array could be modified (moved down
> to ImplicitObjectELResolver)
>
> M jsf-ri/src/com/sun/faces/el/ImplicitObjectELResolver.java
> - Added package private IMPLICIT_OBJECTS array
> - removed unnecessary null checks
>
> M jsf-ri/src/com/sun/faces/el/ImplicitObjectELResolverForJsp.java
> - extend ImplicitObjectELResolver
> - removed unnecessary null checks
>
> M jsf-ri/src/com/sun/faces/renderkit/html_basic/ButtonRenderer.java
> - removed unnecessary null checks
>
> M jsf-ri/src/com/sun/faces/taglib/html_basic/HtmlBasicValidator.java
> M jsf-ri/src/com/sun/faces/taglib/jsf_core/CoreValidator.java
> - Replaced direct modifications to mutable fields in RIConstants with
> new calls to Util.
>
> M jsf-ri/src/com/sun/faces/util/DebugUtil.java
> - removed unecessary null check
>
> M jsf-ri/src/com/sun/faces/util/Util.java
> - added fields with accessors to replace the mutable fields in
> RIConstants
>
> M jsf-ri/test/com/sun/faces/FacesTestCaseService.java
> M jsf-ri/test/com/sun/faces/lifecycle/TestLifecycleImpl.java
> M jsf-ri/test/com/sun/faces/taglib/jsf_core/TestCoreTagsVBEnabled.java
> M jsf-ri/test/com/sun/faces/taglib/jsf_core/TestValidatorTags.java
> - Replaced direct modifications to mutable fields in RIConstants with
> new calls to Util.
>
> SECTION: Diffs
> ----------------------------
> Index: build.properties.tomcat
> ===================================================================
> RCS file: /cvs/javaserverfaces-sources/build.properties.tomcat,v
> retrieving revision 1.3
> diff -u -r1.3 build.properties.tomcat
> --- build.properties.tomcat 19 May 2005 18:46:53 -0000 1.3
> +++ build.properties.tomcat 31 May 2005 14:51:49 -0000
> @@ -41,10 +41,10 @@
> endorsed.dirs=${tomcat.home}/common/endorsed
>
> # ----- JAXP implementation JAR
> -xerces.jar=${java.endorsed.dirs}/xercesImpl.jar
> +xerces.jar=${endorsed.dirs}/xercesImpl.jar
>
> # ----- DOM implementation JAR
> -dom.jar.dir=${tomcat.home}/common/endorsed
> +dom.jar.dir=${endorsed.dirs}
> dom.jar=${dom.jar.dir}/dom.jar
>
> # ----- Build Control Flags -----
> Index: jsf-api/build.xml
> ===================================================================
> RCS file: /cvs/javaserverfaces-sources/jsf-api/build.xml,v
> retrieving revision 1.146
> diff -u -r1.146 build.xml
> --- jsf-api/build.xml 26 May 2005 00:47:41 -0000 1.146
> +++ jsf-api/build.xml 31 May 2005 14:51:50 -0000
> @@ -679,7 +679,8 @@
> haltonfailure="yes" haltonerror="yes">
> <jvmarg line="${debug.jvm.args}"/>
> <jvmarg line="${jvm.assertions}"/>
> - <classpath refid="test.classpath"/>
> + <jvmarg line="-Djava.endorsed.dirs=${endorsed.dirs}"/>
> + <classpath refid="test.classpath"/>
> <formatter type="plain" usefile="false"/>
> <formatter type="xml" usefile="true"/>
> <batchtest todir="${test.results.dir}">
> @@ -697,7 +698,8 @@
> haltonfailure="yes" haltonerror="yes">
> <jvmarg line="${debug.jvm.args}"/>
> <jvmarg line="${jvm.assertions}"/>
> - <classpath refid="test.classpath"/>
> + <jvmarg line="-Djava.endorsed.dirs=${endorsed.dirs}"/>
> + <classpath refid="test.classpath"/>
> <formatter type="plain" usefile="false"/>
> <formatter type="xml" usefile="true"/>
> <batchtest todir="${test.results.dir}">
> @@ -727,7 +729,8 @@
> haltonfailure="yes" haltonerror="yes">
> <jvmarg line="${debug.jvm.args}"/>
> <jvmarg line="${jvm.assertions}"/>
> - <classpath refid="test.classpath"/>
> + <jvmarg line="-Djava.endorsed.dirs=${endorsed.dirs}"/>
> + <classpath refid="test.classpath"/>
> <formatter type="plain" usefile="false"/>
> <formatter type="xml" usefile="true"/>
> <batchtest todir="${test.results.dir}">
> @@ -743,7 +746,8 @@
> haltonfailure="yes" haltonerror="yes">
> <jvmarg line="${debug.jvm.args}"/>
> <jvmarg line="${jvm.assertions}"/>
> - <sysproperty key="base.dir" value="${basedir}"/>
> + <jvmarg line="-Djava.endorsed.dirs=${endorsed.dirs}"/>/fi
> + <sysproperty key="base.dir" value="${basedir}"/>
> <classpath refid="test.classpath"/>
> <formatter type="plain" usefile="false"/>
> <formatter type="xml" usefile="true"/>
> Index: jsf-api/template-src/MethodExpressionMethodBindingAdapter.java
> ===================================================================
> RCS file:
> /cvs/javaserverfaces-sources/jsf-api/template-src/MethodExpressionMethodBindingAdapter.java,v
>
> retrieving revision 1.2
> diff -u -r1.2 MethodExpressionMethodBindingAdapter.java
> --- jsf-api/template-src/MethodExpressionMethodBindingAdapter.java
> 19 May 2005 13:26:58 -0000 1.2
> +++ jsf-api/template-src/MethodExpressionMethodBindingAdapter.java
> 31 May 2005 14:51:52 -0000
> @@ -41,7 +41,7 @@
> // Methods from MethodExpression
> //
>
> - private MethodInfo info = null;
> + private transient MethodInfo info = null;
>
> public MethodInfo getMethodInfo(ELContext context) throws
> ELException {
> assert(null != binding);
> Index: jsf-api/test/javax/faces/mock/MockELContext.java
> ===================================================================
> RCS file:
> /cvs/javaserverfaces-sources/jsf-api/test/javax/faces/mock/MockELContext.java,v
>
> retrieving revision 1.1
> diff -u -r1.1 MockELContext.java
> --- jsf-api/test/javax/faces/mock/MockELContext.java 5 May 2005
> 20:51:15 -0000 1.1
> +++ jsf-api/test/javax/faces/mock/MockELContext.java 31 May 2005
> 14:51:52 -0000
> @@ -19,11 +19,12 @@
>
> private FunctionMapper functionMapper;
> private VariableMapper variableMapper;
> - + private ELResolver resolver;
> +
> protected MockELContext(ELResolver resolver) {
> - super(resolver);
> + this.resolver = resolver;
> }
> - +
> public void setFunctionMapper(FunctionMapper fnMapper) {
> functionMapper = fnMapper;
> }
> @@ -40,4 +41,8 @@
> return variableMapper;
> }
>
> + public ELResolver getELResolver() {
> + return resolver;
> + }
> + }
> Index: jsf-ri/src/com/sun/faces/RIConstants.java
> ===================================================================
> RCS file:
> /cvs/javaserverfaces-sources/jsf-ri/src/com/sun/faces/RIConstants.java,v
> retrieving revision 1.73
> diff -u -r1.73 RIConstants.java
> --- jsf-ri/src/com/sun/faces/RIConstants.java 16 May 2005 20:16:13
> -0000 1.73
> +++ jsf-ri/src/com/sun/faces/RIConstants.java 31 May 2005 14:51:52
> -0000
> @@ -106,8 +106,6 @@
> public static final String PARAM_VALUES_IMPLICIT_OBJ = "paramValues";
> public static final String VIEW_IMPLICIT_OBJ = "view";
>
> - public static boolean IS_UNIT_TEST_MODE = false;
> -
> /*
> * <p>TLV Resource Bundle Location </p>
> */
> @@ -115,9 +113,7 @@
> FACES_PREFIX + "resources.Resources";
>
> public static final Object NO_VALUE = "";
> -
> - public static boolean HTML_TLV_ACTIVE = true;
> - public static boolean CORE_TLV_ACTIVE = true;
> + public static final String CORE_NAMESPACE =
> "http://java.sun.com/jsf/core";
> public static final String HTML_NAMESPACE =
> Index: jsf-ri/src/com/sun/faces/config/ConfigureListener.java
> ===================================================================
> RCS file:
> /cvs/javaserverfaces-sources/jsf-ri/src/com/sun/faces/config/ConfigureListener.java,v
>
> retrieving revision 1.35
> diff -u -r1.35 ConfigureListener.java
> --- jsf-ri/src/com/sun/faces/config/ConfigureListener.java 20 May
> 2005 14:49:58 -0000 1.35
> +++ jsf-ri/src/com/sun/faces/config/ConfigureListener.java 31 May
> 2005 14:51:54 -0000
> @@ -229,7 +229,7 @@
> };
>
> static ThreadLocal getThreadLocalExternalContext() {
> - if (RIConstants.IS_UNIT_TEST_MODE) {
> + if (Util.isUnitTestModeEnabled()) {
> return tlsExternalContext;
> }
> return null;
> @@ -280,7 +280,7 @@
>
> // see if we're operating in the unit test environment
> try {
> - if (RIConstants.IS_UNIT_TEST_MODE) {
> + if (Util.isUnitTestModeEnabled()) {
> // if so, put the fcb in the servletContext
> context.setAttribute(FACES_CONFIG_BEAN_KEY, fcb);
> }
> @@ -292,8 +292,8 @@
> }
>
> // see if we need to disable our TLValidator
> - RIConstants.HTML_TLV_ACTIVE =
> - isFeatureEnabled(context, ENABLE_HTML_TLV);
> + Util.setHtmlTLVActive(
> + isFeatureEnabled(context, ENABLE_HTML_TLV));
>
> URL url = null;
> if (log.isDebugEnabled()) {
> @@ -1344,7 +1344,7 @@
> try {
>
> jspFactory.getClass().getMethod("getJspApplicationContext", new Class[] {
> ServletContext.class });
> - } catch (Exception e) {
> + } catch (NoSuchMethodException nsme) {
>
> log.warn(Util.getExceptionMessage(Util.INCORRECT_JSP_VERSION_ID,
> new Object [] {
> "getJspApplicationContext" }));
> return;
> Index: jsf-ri/src/com/sun/faces/context/ExternalContextImpl.java
> ===================================================================
> RCS file:
> /cvs/javaserverfaces-sources/jsf-ri/src/com/sun/faces/context/ExternalContextImpl.java,v
>
> retrieving revision 1.31
> diff -u -r1.31 ExternalContextImpl.java
> --- jsf-ri/src/com/sun/faces/context/ExternalContextImpl.java 20
> May 2005 14:49:59 -0000 1.31
> +++ jsf-ri/src/com/sun/faces/context/ExternalContextImpl.java 31
> May 2005 14:51:55 -0000
> @@ -86,7 +86,7 @@
> // PENDING(edburns): Craig's workaround breaks
> // TestValidatorTags.java because Cactus expects a certain type
> // to be present for the value of the request.
> - if (RIConstants.IS_UNIT_TEST_MODE) {
> + if (Util.isUnitTestModeEnabled()) {
> this.request = request;
> } else {
> // PENDING(craigmcc) - Work around a Tomcat 4.1 and 5.0 bug
> Index: jsf-ri/src/com/sun/faces/el/ELConstants.java
> ===================================================================
> RCS file:
> /cvs/javaserverfaces-sources/jsf-ri/src/com/sun/faces/el/ELConstants.java,v
>
> retrieving revision 1.1
> diff -u -r1.1 ELConstants.java
> --- jsf-ri/src/com/sun/faces/el/ELConstants.java 5 May 2005
> 20:51:22 -0000 1.1
> +++ jsf-ri/src/com/sun/faces/el/ELConstants.java 31 May 2005
> 14:51:55 -0000
> @@ -43,8 +43,4 @@
>
> public static final int VIEW = 13;
> - public static final String[] IMPLICIT_OBJECTS = new String[] {
> - "application", "applicationScope", "cookie", "facesContext",
> - "header", "headerValues", "initParam", "param", "paramValues",
> - "request", "requestScope", "session", "sessionScope", "view" };
> }
> Index: jsf-ri/src/com/sun/faces/el/ELContextImpl.java
> ===================================================================
> RCS file:
> /cvs/javaserverfaces-sources/jsf-ri/src/com/sun/faces/el/ELContextImpl.java,v
>
> retrieving revision 1.1
> diff -u -r1.1 ELContextImpl.java
> --- jsf-ri/src/com/sun/faces/el/ELContextImpl.java 5 May 2005
> 20:51:22 -0000 1.1
> +++ jsf-ri/src/com/sun/faces/el/ELContextImpl.java 31 May 2005
> 14:51:55 -0000
> @@ -24,13 +24,15 @@
> private FunctionMapper functionMapper;
> private VariableMapper variableMapper;
> + private ELResolver resolver;
> +
> /**
> * Constructs a new ELContext associated with the given ELResolver.
> */
> public ELContextImpl(ELResolver resolver) {
> - super(resolver);
> + this.resolver = resolver;
> }
> - +
> public void setFunctionMapper(FunctionMapper fnMapper) {
> functionMapper = fnMapper;
> }
> @@ -47,5 +49,8 @@
> return variableMapper;
> }
>
> - + public ELResolver getELResolver() {
> + return resolver;
> + }
> +
> }
> Index: jsf-ri/src/com/sun/faces/el/ImplicitObjectELResolver.java
> ===================================================================
> RCS file:
> /cvs/javaserverfaces-sources/jsf-ri/src/com/sun/faces/el/ImplicitObjectELResolver.java,v
>
> retrieving revision 1.1
> diff -u -r1.1 ImplicitObjectELResolver.java
> --- jsf-ri/src/com/sun/faces/el/ImplicitObjectELResolver.java 5 May
> 2005 20:51:22 -0000 1.1
> +++ jsf-ri/src/com/sun/faces/el/ImplicitObjectELResolver.java 31
> May 2005 14:51:56 -0000
> @@ -8,28 +8,30 @@
>
> package com.sun.faces.el;
>
> -import java.util.Arrays;
> +import java.beans.FeatureDescriptor;
> import java.util.ArrayList;
> +import java.util.Arrays;
> import java.util.Iterator;
> import java.util.Map;
> -import java.beans.FeatureDescriptor;
> -
> -import javax.faces.context.ExternalContext;
> -import javax.faces.context.FacesContext;
> -import javax.faces.component.UIViewRoot;
>
> -import javax.el.ELException;
> -import javax.el.PropertyNotWritableException;
> -import javax.el.PropertyNotFoundException;
> -import javax.el.PropertyNotFoundException;
> import javax.el.ELContext;
> +import javax.el.ELException;
> import javax.el.ELResolver;
> +import javax.el.PropertyNotFoundException;
> +import javax.el.PropertyNotWritableException;
> +import javax.faces.component.UIViewRoot;
> +import javax.faces.context.ExternalContext;
> +import javax.faces.context.FacesContext;
>
> -import com.sun.faces.el.ELConstants;
> import com.sun.faces.util.Util;
>
> public class ImplicitObjectELResolver extends ELResolver implements
> ELConstants{
>
> + static final String[] IMPLICIT_OBJECTS = new String[] {
> + "application", "applicationScope", "cookie", "facesContext",
> + "header", "headerValues", "initParam", "param", "paramValues",
> + "request", "requestScope", "session", "sessionScope", "view" };
> +
> public ImplicitObjectELResolver() {
> }
>
> @@ -40,7 +42,7 @@
> if (base != null) {
> return null;
> }
> - if ( base == null && property == null) {
> + if (property == null) {
> String message = Util.getExceptionMessageString
> (Util.NULL_PARAMETERS_ERROR_MESSAGE_ID);
> message = message + " base " + base + " property " +
> property;
> @@ -108,7 +110,7 @@
> if (base != null) {
> return;
> }
> - if ( base == null && property == null) {
> + if (property == null) {
> String message = Util.getExceptionMessageString
> (Util.NULL_PARAMETERS_ERROR_MESSAGE_ID);
> message = message + " base " + base + " property " +
> property;
> @@ -116,7 +118,7 @@
> }
> int index = Arrays.binarySearch(IMPLICIT_OBJECTS,
> property);
> - if ((base == null) && (index > 0)) {
> + if (index > 0) {
> throw new PropertyNotWritableException((String)property);
> }
> }
> @@ -126,7 +128,7 @@
> if (base != null) {
> return false;
> }
> - if ( base == null && property == null) {
> + if (property == null) {
> String message = Util.getExceptionMessageString
> (Util.NULL_PARAMETERS_ERROR_MESSAGE_ID);
> message = message + " base " + base + " property " +
> property;
> @@ -134,7 +136,7 @@
> }
> int index = Arrays.binarySearch(IMPLICIT_OBJECTS,
> property);
> - if ((base == null) && (index > 0)) {
> + if (index > 0) {
> context.setPropertyResolved(true);
> return true;
> } @@ -146,7 +148,7 @@
> if (base != null) {
> return null;
> }
> - if ( base == null && property == null) {
> + if (property == null) {
> String message = Util.getExceptionMessageString
> (Util.NULL_PARAMETERS_ERROR_MESSAGE_ID);
> message = message + " base " + base + " property " +
> property;
> @@ -154,7 +156,7 @@
> }
> int index = Arrays.binarySearch(IMPLICIT_OBJECTS,
> property);
> - if ((base == null) && (index > 0)) {
> + if (index > 0) {
> context.setPropertyResolved(true);
> }
> return null;
> Index: jsf-ri/src/com/sun/faces/el/ImplicitObjectELResolverForJsp.java
> ===================================================================
> RCS file:
> /cvs/javaserverfaces-sources/jsf-ri/src/com/sun/faces/el/ImplicitObjectELResolverForJsp.java,v
>
> retrieving revision 1.1
> diff -u -r1.1 ImplicitObjectELResolverForJsp.java
> --- jsf-ri/src/com/sun/faces/el/ImplicitObjectELResolverForJsp.java
> 5 May 2005 20:51:23 -0000 1.1
> +++ jsf-ri/src/com/sun/faces/el/ImplicitObjectELResolverForJsp.java
> 31 May 2005 14:51:56 -0000
> @@ -22,8 +22,7 @@
>
> import com.sun.faces.util.Util;
>
> -public class ImplicitObjectELResolverForJsp extends ELResolver
> implements
> - ELConstants{
> +public class ImplicitObjectELResolverForJsp extends
> ImplicitObjectELResolver {
>
> public ImplicitObjectELResolverForJsp() {
> }
> @@ -35,7 +34,7 @@
> if (base != null) {
> return null;
> }
> - if ( base == null && property == null) {
> + if (property == null) {
> String message = Util.getExceptionMessageString
> (Util.NULL_PARAMETERS_ERROR_MESSAGE_ID);
> message = message + " base " + base + " property " +
> property;
> @@ -67,7 +66,7 @@
> if (base != null) {
> return null;
> }
> - if ( base == null && property == null) {
> + if (property == null) {
> String message = Util.getExceptionMessageString
> (Util.NULL_PARAMETERS_ERROR_MESSAGE_ID);
> message = message + " base " + base + " property " +
> property;
> @@ -79,10 +78,10 @@
> return null;
> }
> switch (index) {
> - case FACES_CONTEXT:
> - context.setPropertyResolved(true);
> + case FACES_CONTEXT: case VIEW:
> context.setPropertyResolved(true);
> + return null;
> default:
> return null;
> }
> @@ -93,7 +92,7 @@
> if (base != null) {
> return;
> }
> - if ( base == null && property == null) {
> + if (property == null) {
> String message = Util.getExceptionMessageString
> (Util.NULL_PARAMETERS_ERROR_MESSAGE_ID);
> message = message + " base " + base + " property " +
> property;
> @@ -120,7 +119,7 @@
> if (base != null) {
> return false;
> }
> - if ( base == null && property == null) {
> + if (property == null) {
> String message = Util.getExceptionMessageString
> (Util.NULL_PARAMETERS_ERROR_MESSAGE_ID);
> message = message + " base " + base + " property " +
> property;
> Index: jsf-ri/src/com/sun/faces/renderkit/html_basic/ButtonRenderer.java
> ===================================================================
> RCS file:
> /cvs/javaserverfaces-sources/jsf-ri/src/com/sun/faces/renderkit/html_basic/ButtonRenderer.java,v
>
> retrieving revision 1.86
> diff -u -r1.86 ButtonRenderer.java
> ---
> jsf-ri/src/com/sun/faces/renderkit/html_basic/ButtonRenderer.java 16
> May 2005 20:16:25 -0000 1.86
> +++
> jsf-ri/src/com/sun/faces/renderkit/html_basic/ButtonRenderer.java 31
> May 2005 14:51:57 -0000
> @@ -299,10 +299,8 @@
> String
> rendererType = curNode.getRendererType(),
> family = curNode.getFamily();
> - if (null != rendererType &&
> - rendererType.equals("javax.faces.Link") &&
> - null != family &
> - family.equals("javax.faces.Command")) {
> + if ("javax.faces.Link".equals(rendererType) &&
> + "javax.faces.Command".equals(family)) {
> keepGoing = false;
> }
> Index: jsf-ri/src/com/sun/faces/taglib/html_basic/HtmlBasicValidator.java
> ===================================================================
> RCS file:
> /cvs/javaserverfaces-sources/jsf-ri/src/com/sun/faces/taglib/html_basic/HtmlBasicValidator.java,v
>
> retrieving revision 1.13
> diff -u -r1.13 HtmlBasicValidator.java
> ---
> jsf-ri/src/com/sun/faces/taglib/html_basic/HtmlBasicValidator.java 2
> Dec 2004 18:42:23 -0000 1.13
> +++
> jsf-ri/src/com/sun/faces/taglib/html_basic/HtmlBasicValidator.java
> 31 May 2005 14:51:58 -0000
> @@ -12,11 +12,10 @@
> import com.sun.faces.taglib.FacesValidator;
> import com.sun.faces.taglib.ValidatorInfo;
> import com.sun.faces.util.Util;
> +
> import org.xml.sax.Attributes;
> import org.xml.sax.helpers.DefaultHandler;
>
> -import com.sun.faces.RIConstants;
> -
>
> /**
> * <p>Top level validator for the html_basic tld</p>
> @@ -61,7 +60,7 @@
> // don't run the TLV if we're in designTime, or the RIConstants
> // says not to.
> if (java.beans.Beans.isDesignTime() ||
> - !RIConstants.HTML_TLV_ACTIVE) {
> + !Util.isHtmlTLVActive()) {
> return null;
> }
> Index: jsf-ri/src/com/sun/faces/taglib/jsf_core/CoreValidator.java
> ===================================================================
> RCS file:
> /cvs/javaserverfaces-sources/jsf-ri/src/com/sun/faces/taglib/jsf_core/CoreValidator.java,v
>
> retrieving revision 1.15
> diff -u -r1.15 CoreValidator.java
> --- jsf-ri/src/com/sun/faces/taglib/jsf_core/CoreValidator.java 8
> Dec 2004 17:55:35 -0000 1.15
> +++ jsf-ri/src/com/sun/faces/taglib/jsf_core/CoreValidator.java 31
> May 2005 14:51:58 -0000
> @@ -9,9 +9,10 @@
>
> package com.sun.faces.taglib.jsf_core;
>
> -import com.sun.faces.RIConstants;
> import com.sun.faces.taglib.FacesValidator;
> import com.sun.faces.taglib.ValidatorInfo;
> +import com.sun.faces.util.Util;
> +
> import org.xml.sax.Attributes;
> import org.xml.sax.helpers.DefaultHandler;
>
> @@ -80,7 +81,7 @@
> */
> protected DefaultHandler getSAXHandler() {
> if (java.beans.Beans.isDesignTime() ||
> - !RIConstants.CORE_TLV_ACTIVE) {
> + !Util.isCoreTLVActive()) {
> return null;
> }
> DefaultHandler h = new CoreValidatorHandler();
> Index: jsf-ri/src/com/sun/faces/util/DebugUtil.java
> ===================================================================
> RCS file:
> /cvs/javaserverfaces-sources/jsf-ri/src/com/sun/faces/util/DebugUtil.java,v
>
> retrieving revision 1.27
> diff -u -r1.27 DebugUtil.java
> --- jsf-ri/src/com/sun/faces/util/DebugUtil.java 21 Apr 2005
> 18:55:39 -0000 1.27
> +++ jsf-ri/src/com/sun/faces/util/DebugUtil.java 31 May 2005
> 14:51:59 -0000
> @@ -11,17 +11,17 @@
>
> // DebugUtil.java
>
> -import javax.faces.component.UIComponent;
> -import javax.faces.component.ValueHolder;
> -import javax.faces.model.SelectItem;
> -
> +import java.io.IOException;
> import java.io.PrintStream;
> -import java.io.Writer;
> import java.io.PrintWriter;
> import java.io.StringWriter;
> -import java.io.IOException;
> +import java.io.Writer;
> import java.util.Iterator;
>
> +import javax.faces.component.UIComponent;
> +import javax.faces.component.ValueHolder;
> +import javax.faces.model.SelectItem;
> +
> /**
> * <B>DebugUtil</B> is a class ...
> * <p/>
> @@ -154,7 +154,7 @@
> }
> indentPrintln(out, " }");
> } else {
> - if (null != root && (root instanceof ValueHolder)) {
> + if (root instanceof ValueHolder) {
> value = ((ValueHolder)root).getValue();
> }
> indentPrintln(out, "value= " + value);
> Index: jsf-ri/src/com/sun/faces/util/Util.java
> ===================================================================
> RCS file:
> /cvs/javaserverfaces-sources/jsf-ri/src/com/sun/faces/util/Util.java,v
> retrieving revision 1.161
> diff -u -r1.161 Util.java
> --- jsf-ri/src/com/sun/faces/util/Util.java 23 May 2005 14:38:34
> -0000 1.161
> +++ jsf-ri/src/com/sun/faces/util/Util.java 31 May 2005 14:52:01 -0000
> @@ -424,7 +424,21 @@
> //attrs above All renderers that need this attribute should manually
> //pass it.
>
> -
> + /**
> + * Flag that, when true, enables special behavior in the RI to
> enable
> + * unit testing.
> + */
> + private static boolean unitTestModeEnabled = false;
> +
> + /**
> + * Flag that enables/disables the core TLV.
> + */
> + private static boolean coreTLVEnabled = true;
> +
> + /**
> + * Flag that enables/disables the html TLV.
> + */
> + private static boolean htmlTLVEnabled = true;
>
> //
> // Instance Variables
> @@ -445,6 +459,32 @@
> //
> // Class methods
> //
> +
> + public static void setUnitTestModeEnabled(boolean enabled) {
> + unitTestModeEnabled = enabled;
> + }
> +
> + public static boolean isUnitTestModeEnabled() {
> + return unitTestModeEnabled;
> + }
> +
> + public static void setCoreTLVActive(boolean active) {
> + coreTLVEnabled = active;
> + }
> +
> + public static boolean isCoreTLVActive() {
> + return coreTLVEnabled;
> + }
> +
> + public static void setHtmlTLVActive(boolean active) {
> + htmlTLVEnabled = active;
> + }
> +
> + public static boolean isHtmlTLVActive() {
> + return htmlTLVEnabled;
> + }
> +
> +
> public static Class loadClass(String name,
> Object fallbackClass)
> throws ClassNotFoundException {
> Index: jsf-ri/test/com/sun/faces/FacesTestCaseService.java
> ===================================================================
> RCS file:
> /cvs/javaserverfaces-sources/jsf-ri/test/com/sun/faces/FacesTestCaseService.java,v
>
> retrieving revision 1.43
> diff -u -r1.43 FacesTestCaseService.java
> --- jsf-ri/test/com/sun/faces/FacesTestCaseService.java 5 Apr 2005
> 22:03:01 -0000 1.43
> +++ jsf-ri/test/com/sun/faces/FacesTestCaseService.java 31 May 2005
> 14:52:03 -0000
> @@ -11,14 +11,16 @@
>
> package com.sun.faces;
>
> -import com.sun.faces.config.ConfigureListener;
> -import com.sun.faces.application.ApplicationAssociate;
> -import com.sun.faces.util.Util;
> -import org.apache.cactus.server.ServletContextWrapper;
> +import java.io.File;
> +import java.io.FileReader;
> +import java.io.IOException;
> +import java.io.LineNumberReader;
> +import java.util.ArrayList;
> +import java.util.Enumeration;
> +import java.util.Iterator;
>
> import javax.faces.FactoryFinder;
> import javax.faces.context.FacesContext;
> -import javax.faces.context.ExternalContext;
> import javax.faces.context.FacesContextFactory;
> import javax.faces.context.ResponseWriter;
> import javax.faces.lifecycle.Lifecycle;
> @@ -26,18 +28,14 @@
> import javax.faces.webapp.FacesServlet;
> import javax.servlet.ServletContextEvent;
> import javax.servlet.http.HttpServletRequest;
> -import javax.servlet.http.HttpServletResponse;
> import javax.servlet.http.HttpServletRequestWrapper;
> +import javax.servlet.http.HttpServletResponse;
>
> -import java.io.File;
> -import java.io.FileReader;
> -import java.io.IOException;
> -import java.io.LineNumberReader;
> -import java.util.ArrayList;
> -import java.util.Enumeration;
> -import java.util.Iterator;
> +import com.sun.faces.application.ApplicationAssociate;
> +import com.sun.faces.config.ConfigureListener;
> +import com.sun.faces.util.Util;
>
> -import com.sun.faces.RIConstants;
> +import org.apache.cactus.server.ServletContextWrapper;
>
>
> /**
> @@ -120,7 +118,7 @@
>
> public void setUp() {
> HttpServletResponse response = null;
> - RIConstants.IS_UNIT_TEST_MODE = true;
> + Util.setUnitTestModeEnabled(true);
>
> // make sure the ApplicationAssociate is aware of the ServletContext
> com.sun.faces.config.StoreServletContext storeSC =
> Index: jsf-ri/test/com/sun/faces/lifecycle/TestLifecycleImpl.java
> ===================================================================
> RCS file:
> /cvs/javaserverfaces-sources/jsf-ri/test/com/sun/faces/lifecycle/TestLifecycleImpl.java,v
>
> retrieving revision 1.34
> diff -u -r1.34 TestLifecycleImpl.java
> --- jsf-ri/test/com/sun/faces/lifecycle/TestLifecycleImpl.java 2
> May 2005 19:27:15 -0000 1.34
> +++ jsf-ri/test/com/sun/faces/lifecycle/TestLifecycleImpl.java 31
> May 2005 14:52:03 -0000
> @@ -11,11 +11,6 @@
>
> package com.sun.faces.lifecycle;
>
> -import com.sun.faces.JspFacesTestCase;
> -import com.sun.faces.RIConstants;
> -import com.sun.faces.util.Util;
> -import org.apache.cactus.WebRequest;
> -
> import javax.faces.component.UIForm;
> import javax.faces.component.UIInput;
> import javax.faces.component.UIViewRoot;
> @@ -23,7 +18,11 @@
> import javax.faces.event.PhaseEvent;
> import javax.faces.event.PhaseId;
> import javax.faces.event.PhaseListener;
> -import javax.servlet.http.HttpSession;
> +
> +import com.sun.faces.JspFacesTestCase;
> +import com.sun.faces.util.Util;
> +
> +import org.apache.cactus.WebRequest;
>
> /**
> * <B>TestLifecycleImpl</B> is a class ...
> @@ -98,7 +97,7 @@
>
>
> public void setUp() {
> - RIConstants.IS_UNIT_TEST_MODE = true;
> + Util.setUnitTestModeEnabled(true);
> super.setUp();
> FacesContext context = getFacesContext();
> UIViewRoot root =
> Util.getViewHandler(context).createView(context, null);
> Index:
> jsf-ri/test/com/sun/faces/taglib/jsf_core/TestCoreTagsVBEnabled.java
> ===================================================================
> RCS file:
> /cvs/javaserverfaces-sources/jsf-ri/test/com/sun/faces/taglib/jsf_core/TestCoreTagsVBEnabled.java,v
>
> retrieving revision 1.6
> diff -u -r1.6 TestCoreTagsVBEnabled.java
> ---
> jsf-ri/test/com/sun/faces/taglib/jsf_core/TestCoreTagsVBEnabled.java
> 7 Apr 2004 17:53:03 -0000 1.6
> +++
> jsf-ri/test/com/sun/faces/taglib/jsf_core/TestCoreTagsVBEnabled.java
> 31 May 2005 14:52:04 -0000
> @@ -9,20 +9,20 @@
>
> package com.sun.faces.taglib.jsf_core;
>
> +import java.util.Iterator;
> +
> +import javax.faces.component.NamingContainer;
> +import javax.faces.component.UIComponent;
> +import javax.faces.component.UIViewRoot;
> +
> import com.sun.faces.JspFacesTestCase;
> -import com.sun.faces.RIConstants;
> import com.sun.faces.lifecycle.ApplyRequestValuesPhase;
> import com.sun.faces.lifecycle.Phase;
> import com.sun.faces.lifecycle.ProcessValidationsPhase;
> import com.sun.faces.lifecycle.RenderResponsePhase;
> import com.sun.faces.util.Util;
> -import org.apache.cactus.WebRequest;
>
> -import javax.faces.component.NamingContainer;
> -import javax.faces.component.UIComponent;
> -import javax.faces.component.UIViewRoot;
> -
> -import java.util.Iterator;
> +import org.apache.cactus.WebRequest;
>
> /**
> * <B>TestValidatorTags</B> is a class ...
> @@ -103,7 +103,7 @@
>
> public void setUp() {
>
> - RIConstants.IS_UNIT_TEST_MODE = true;
> + Util.setUnitTestModeEnabled(true);
> super.setUp();
>
> (getFacesContext().getExternalContext().getRequestMap()).put("intMin",
>
> new Integer(
> @@ -203,7 +203,7 @@
> assertTrue(messages.hasNext());
>
>
> - RIConstants.IS_UNIT_TEST_MODE = false;
> + Util.setUnitTestModeEnabled(false);
> }
>
>
> Index: jsf-ri/test/com/sun/faces/taglib/jsf_core/TestValidatorTags.java
> ===================================================================
> RCS file:
> /cvs/javaserverfaces-sources/jsf-ri/test/com/sun/faces/taglib/jsf_core/TestValidatorTags.java,v
>
> retrieving revision 1.27
> diff -u -r1.27 TestValidatorTags.java
> --- jsf-ri/test/com/sun/faces/taglib/jsf_core/TestValidatorTags.java
> 7 Apr 2004 17:53:03 -0000 1.27
> +++ jsf-ri/test/com/sun/faces/taglib/jsf_core/TestValidatorTags.java
> 31 May 2005 14:52:04 -0000
> @@ -11,20 +11,20 @@
>
> package com.sun.faces.taglib.jsf_core;
>
> +import java.util.Iterator;
> +
> +import javax.faces.component.NamingContainer;
> +import javax.faces.component.UIComponent;
> +import javax.faces.component.UIViewRoot;
> +
> import com.sun.faces.JspFacesTestCase;
> -import com.sun.faces.RIConstants;
> import com.sun.faces.lifecycle.ApplyRequestValuesPhase;
> import com.sun.faces.lifecycle.Phase;
> import com.sun.faces.lifecycle.ProcessValidationsPhase;
> import com.sun.faces.lifecycle.RenderResponsePhase;
> import com.sun.faces.util.Util;
> -import org.apache.cactus.WebRequest;
>
> -import javax.faces.component.NamingContainer;
> -import javax.faces.component.UIComponent;
> -import javax.faces.component.UIViewRoot;
> -
> -import java.util.Iterator;
> +import org.apache.cactus.WebRequest;
>
> /**
> * <B>TestValidatorTags</B> is a class ...
> @@ -129,7 +129,7 @@
>
>
> public void setUp() {
> - RIConstants.IS_UNIT_TEST_MODE = true;
> + Util.setUnitTestModeEnabled(true);
> super.setUp();
> }
>
> @@ -250,7 +250,7 @@
>
> getFacesContext().getMessages(comp.getClientId(getFacesContext()))));
> assertTrue(messages.hasNext());
>
> - RIConstants.IS_UNIT_TEST_MODE = false;
> + Util.setUnitTestModeEnabled(false);
> }
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_javaserverfaces.dev.java.net
> For additional commands, e-mail: dev-help_at_javaserverfaces.dev.java.net
>
r=rogerk.