--- java/javax/servlet/AsyncEvent.java (revision 1001705) +++ java/javax/servlet/AsyncEvent.java (working copy) @@ -21,13 +21,16 @@ * @since Servlet 3.0 */ public class AsyncEvent { - private AsyncContext context; - private ServletRequest request; - private ServletResponse response; - private Throwable throwable; + private final AsyncContext context; + private final ServletRequest request; + private final ServletResponse response; + private final Throwable throwable; public AsyncEvent(AsyncContext context) { this.context = context; + this.request = null; + this.response = null; + this.throwable = null; } public AsyncEvent(AsyncContext context, ServletRequest request, @@ -35,11 +38,14 @@ this.context = context; this.request = request; this.response = response; + this.throwable = null; } public AsyncEvent(AsyncContext context, Throwable throwable) { this.context = context; this.throwable = throwable; + this.request = null; + this.response = null; } public AsyncEvent(AsyncContext context, ServletRequest request, --- java/javax/servlet/HttpConstraintElement.java (revision 1001705) +++ java/javax/servlet/HttpConstraintElement.java (working copy) @@ -31,15 +31,18 @@ private static final ResourceBundle lStrings = ResourceBundle.getBundle(LSTRING_FILE); - private EmptyRoleSemantic emptyRoleSemantic = EmptyRoleSemantic.PERMIT; - private TransportGuarantee transportGuarantee = TransportGuarantee.NONE; - private String[] rolesAllowed = new String[0]; + private final EmptyRoleSemantic emptyRoleSemantic;// = EmptyRoleSemantic.PERMIT; + private final TransportGuarantee transportGuarantee;// = TransportGuarantee.NONE; + private final String[] rolesAllowed;// = new String[0]; /** * Default constraint is permit with no transport guarantee. */ public HttpConstraintElement() { // Default constructor + this.emptyRoleSemantic = EmptyRoleSemantic.PERMIT; + this.transportGuarantee = TransportGuarantee.NONE; + this.rolesAllowed = new String[0]; } /** @@ -48,6 +51,8 @@ */ public HttpConstraintElement(EmptyRoleSemantic emptyRoleSemantic) { this.emptyRoleSemantic = emptyRoleSemantic; + this.transportGuarantee = TransportGuarantee.NONE; + this.rolesAllowed = new String[0]; } /** @@ -55,6 +60,7 @@ */ public HttpConstraintElement(TransportGuarantee transportGuarantee, String... rolesAllowed) { + this.emptyRoleSemantic = EmptyRoleSemantic.PERMIT; this.transportGuarantee = transportGuarantee; this.rolesAllowed = rolesAllowed; } --- java/javax/servlet/HttpMethodConstraintElement.java (revision 1001705) +++ java/javax/servlet/HttpMethodConstraintElement.java (working copy) @@ -29,7 +29,7 @@ private static final ResourceBundle lStrings = ResourceBundle.getBundle(LSTRING_FILE); - private String methodName; + private final String methodName; public HttpMethodConstraintElement(String methodName) { if (methodName == null || methodName.length() == 0) { --- java/javax/servlet/MultipartConfigElement.java (revision 1001705) +++ java/javax/servlet/MultipartConfigElement.java (working copy) @@ -24,16 +24,21 @@ */ public class MultipartConfigElement { - private String location = ""; - private long maxFileSize = -1; - private long maxRequestSize = -1; - private int fileSizeThreshold = 0; + private final String location;// = ""; + private final long maxFileSize;// = -1; + private final long maxRequestSize;// = -1; + private final int fileSizeThreshold;// = 0; public MultipartConfigElement(String location) { // Keep empty string default if location is null if (location != null) { this.location = location; + } else { + this.location = ""; } + this.maxFileSize = -1; + this.maxRequestSize = -1; + this.fileSizeThreshold = 0; } public MultipartConfigElement(String location, long maxFileSize, @@ -41,6 +46,8 @@ // Keep empty string default if location is null if (location != null) { this.location = location; + } else { + this.location = ""; } this.maxFileSize = maxFileSize; this.maxRequestSize = maxRequestSize; --- java/javax/servlet/ServletContextAttributeEvent.java (revision 1001705) +++ java/javax/servlet/ServletContextAttributeEvent.java (working copy) @@ -24,8 +24,8 @@ * @since v 2.3 */ public class ServletContextAttributeEvent extends ServletContextEvent { - private String name; - private Object value; + private final String name; + private final Object value; /** * Construct a ServletContextAttributeEvent from the given context for the --- java/javax/servlet/ServletRequestAttributeEvent.java (revision 1001705) +++ java/javax/servlet/ServletRequestAttributeEvent.java (working copy) @@ -24,8 +24,8 @@ * @since Servlet 2.4 */ public class ServletRequestAttributeEvent extends ServletRequestEvent { - private String name; - private Object value; + private final String name; + private final Object value; /** * Construct a ServletRequestAttributeEvent giving the servlet context of --- java/javax/servlet/ServletRequestEvent.java (revision 1001705) +++ java/javax/servlet/ServletRequestEvent.java (working copy) @@ -24,7 +24,7 @@ * @since Servlet 2.4 */ public class ServletRequestEvent extends java.util.EventObject { - private ServletRequest request; + private final ServletRequest request; /** * Construct a ServletRequestEvent for the given ServletContext and --- java/javax/servlet/ServletSecurityElement.java (revision 1001705) +++ java/javax/servlet/ServletSecurityElement.java (working copy) @@ -32,7 +32,7 @@ */ public class ServletSecurityElement extends HttpConstraintElement { - private Map methodConstraints = + private final Map methodConstraints = new HashMap(); /** --- java/javax/servlet/UnavailableException.java (revision 1001705) +++ java/javax/servlet/UnavailableException.java (working copy) @@ -44,9 +44,9 @@ */ public class UnavailableException extends ServletException { - private Servlet servlet; // what's unavailable - private boolean permanent; // needs admin action? - private int seconds; // unavailability estimate + private final Servlet servlet; // what's unavailable + private final boolean permanent; // needs admin action? + private final int seconds; // unavailability estimate /** * @param servlet @@ -62,6 +62,7 @@ super(msg); this.servlet = servlet; permanent = true; + this.seconds = 0; } /** @@ -98,7 +99,8 @@ */ public UnavailableException(String msg) { super(msg); - + seconds = 0; + servlet = null; permanent = true; } @@ -128,7 +130,7 @@ this.seconds = -1; else this.seconds = seconds; - + servlet = null; permanent = false; } --- java/javax/servlet/http/HttpSessionBindingEvent.java (revision 1001705) +++ java/javax/servlet/http/HttpSessionBindingEvent.java (working copy) @@ -38,11 +38,11 @@ /* The name to which the object is being bound or unbound */ - private String name; + private final String name; /* The object is being bound or unbound */ - private Object value; + private final Object value; /** * Constructs an event that notifies an object that it has been bound to or @@ -59,6 +59,7 @@ public HttpSessionBindingEvent(HttpSession session, String name) { super(session); this.name = name; + this.value = null; } /** --- java/javax/servlet/jsp/ErrorData.java (revision 1001705) +++ java/javax/servlet/jsp/ErrorData.java (working copy) @@ -27,10 +27,10 @@ */ public final class ErrorData { - private Throwable throwable; - private int statusCode; - private String uri; - private String servletName; + private final Throwable throwable; + private final int statusCode; + private final String uri; + private final String servletName; /** * Creates a new ErrorData object. --- java/javax/servlet/jsp/tagext/BodyContent.java (revision 1001705) +++ java/javax/servlet/jsp/tagext/BodyContent.java (working copy) @@ -121,5 +121,5 @@ // private fields - private JspWriter enclosingWriter; + private final JspWriter enclosingWriter; } --- java/javax/servlet/jsp/tagext/FunctionInfo.java (revision 1001705) +++ java/javax/servlet/jsp/tagext/FunctionInfo.java (working copy) @@ -73,7 +73,7 @@ /* * fields */ - private String name; - private String functionClass; - private String functionSignature; + private final String name; + private final String functionClass; + private final String functionSignature; } --- java/javax/servlet/jsp/tagext/TagAttributeInfo.java (revision 1001705) +++ java/javax/servlet/jsp/tagext/TagAttributeInfo.java (working copy) @@ -51,10 +51,7 @@ public TagAttributeInfo(String name, boolean required, String type, boolean reqTime) { - this.name = name; - this.required = required; - this.type = type; - this.reqTime = reqTime; + this(name, required, type, reqTime, false); } /** @@ -78,8 +75,7 @@ public TagAttributeInfo(String name, boolean required, String type, boolean reqTime, boolean fragment) { - this(name, required, type, reqTime); - this.fragment = fragment; + this(name, required, type, reqTime, fragment, null, false, false, null, null); } /** @@ -89,7 +85,11 @@ boolean reqTime, boolean fragment, String description, boolean deferredValue, boolean deferredMethod, String expectedTypeName, String methodSignature) { - this(name, required, type, reqTime, fragment); + this.name = name; + this.required = required; + this.type = type; + this.reqTime = reqTime; + this.fragment = fragment; this.description = description; this.deferredValue = deferredValue; this.deferredMethod = deferredMethod; @@ -188,31 +188,31 @@ /* * private fields */ - private String name; + private final String name; - private String type; + private final String type; - private boolean reqTime; + private final boolean reqTime; - private boolean required; + private final boolean required; /* * private fields for JSP 2.0 */ - private boolean fragment; + private final boolean fragment; /* * private fields for JSP 2.1 */ - private String description; + private final String description; - private boolean deferredValue; + private final boolean deferredValue; - private boolean deferredMethod; + private final boolean deferredMethod; - private String expectedTypeName; + private final String expectedTypeName; - private String methodSignature; + private final String methodSignature; public boolean isDeferredMethod() { return deferredMethod; --- java/javax/servlet/jsp/tagext/TagData.java (revision 1001705) +++ java/javax/servlet/jsp/tagext/TagData.java (working copy) @@ -149,5 +149,5 @@ // private data - private Hashtable attributes; // the tagname/value map + private final Hashtable attributes; // the tagname/value map } --- java/javax/servlet/jsp/tagext/TagExtraInfo.java (revision 1001705) +++ java/javax/servlet/jsp/tagext/TagExtraInfo.java (working copy) @@ -137,7 +137,7 @@ } // private data - private TagInfo tagInfo; + private TagInfo tagInfo; // zero length VariableInfo array private static final VariableInfo[] ZERO_VARIABLE_INFO = { }; --- java/javax/servlet/jsp/tagext/TagFileInfo.java (revision 1001705) +++ java/javax/servlet/jsp/tagext/TagFileInfo.java (working copy) @@ -80,7 +80,7 @@ } // private fields for 2.0 info - private String name; - private String path; - private TagInfo tagInfo; + private final String name; + private final String path; + private final TagInfo tagInfo; } --- java/javax/servlet/jsp/tagext/TagVariableInfo.java (revision 1001705) +++ java/javax/servlet/jsp/tagext/TagVariableInfo.java (working copy) @@ -101,9 +101,9 @@ /* * private fields */ - private String nameGiven; // - private String nameFromAttribute; // - private String className; // - private boolean declare; // - private int scope; // + private final String nameGiven; // + private final String nameFromAttribute; // + private final String className; // + private final boolean declare; // + private final int scope; // } --- java/javax/servlet/jsp/tagext/ValidationMessage.java (revision 1001705) +++ java/javax/servlet/jsp/tagext/ValidationMessage.java (working copy) @@ -72,6 +72,6 @@ } // Private data - private String id; - private String message; + private final String id; + private final String message; } --- java/javax/servlet/jsp/tagext/VariableInfo.java (revision 1001705) +++ java/javax/servlet/jsp/tagext/VariableInfo.java (working copy) @@ -250,8 +250,8 @@ } // == private data - private String varName; - private String className; - private boolean declare; - private int scope; + private final String varName; + private final String className; + private final boolean declare; + private final int scope; }