Author: markt
Date: Sun Mar 13 12:46:36 2016
New Revision: 1734801

URL: http://svn.apache.org/viewvc?rev=1734801&view=rev
Log:
Back-port clean-up and Javadoc fixes from trunk to simplify diff with new 8.5.x 
release branch

Modified:
    tomcat/tc8.0.x/trunk/java/javax/el/CompositeELResolver.java
    tomcat/tc8.0.x/trunk/java/javax/servlet/ServletContext.java
    
tomcat/tc8.0.x/trunk/java/javax/servlet/jsp/el/ScopedAttributeELResolver.java
    tomcat/tc8.0.x/trunk/java/javax/websocket/SendResult.java

Modified: tomcat/tc8.0.x/trunk/java/javax/el/CompositeELResolver.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/java/javax/el/CompositeELResolver.java?rev=1734801&r1=1734800&r2=1734801&view=diff
==============================================================================
--- tomcat/tc8.0.x/trunk/java/javax/el/CompositeELResolver.java (original)
+++ tomcat/tc8.0.x/trunk/java/javax/el/CompositeELResolver.java Sun Mar 13 
12:46:36 2016
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package javax.el;
 
 import java.beans.FeatureDescriptor;
@@ -27,8 +26,7 @@ public class CompositeELResolver extends
     static {
         Class<?> clazz = null;
         try {
-            clazz =
-                
Class.forName("javax.servlet.jsp.el.ScopedAttributeELResolver");
+            clazz = 
Class.forName("javax.servlet.jsp.el.ScopedAttributeELResolver");
         } catch (ClassNotFoundException e) {
             // Ignore. This is expected if using the EL stand-alone
         }
@@ -61,9 +59,8 @@ public class CompositeELResolver extends
     public Object getValue(ELContext context, Object base, Object property) {
         context.setPropertyResolved(false);
         int sz = this.size;
-        Object result = null;
         for (int i = 0; i < sz; i++) {
-            result = this.resolvers[i].getValue(context, base, property);
+            Object result = this.resolvers[i].getValue(context, base, 
property);
             if (context.isPropertyResolved()) {
                 return result;
             }
@@ -79,10 +76,8 @@ public class CompositeELResolver extends
             Class<?>[] paramTypes, Object[] params) {
         context.setPropertyResolved(false);
         int sz = this.size;
-        Object obj;
         for (int i = 0; i < sz; i++) {
-            obj = this.resolvers[i].invoke(context, base, method, paramTypes,
-                    params);
+            Object obj = this.resolvers[i].invoke(context, base, method, 
paramTypes, params);
             if (context.isPropertyResolved()) {
                 return obj;
             }
@@ -94,18 +89,15 @@ public class CompositeELResolver extends
     public Class<?> getType(ELContext context, Object base, Object property) {
         context.setPropertyResolved(false);
         int sz = this.size;
-        Class<?> type;
         for (int i = 0; i < sz; i++) {
-            type = this.resolvers[i].getType(context, base, property);
+            Class<?> type = this.resolvers[i].getType(context, base, property);
             if (context.isPropertyResolved()) {
                 if (SCOPED_ATTRIBUTE_EL_RESOLVER != null &&
-                        SCOPED_ATTRIBUTE_EL_RESOLVER.isAssignableFrom(
-                                resolvers[i].getClass())) {
+                        
SCOPED_ATTRIBUTE_EL_RESOLVER.isAssignableFrom(resolvers[i].getClass())) {
                     // Special case since
                     // javax.servlet.jsp.el.ScopedAttributeELResolver will
                     // always return Object.class for type
-                    Object value =
-                        resolvers[i].getValue(context, base, property);
+                    Object value = resolvers[i].getValue(context, base, 
property);
                     if (value != null) {
                         return value.getClass();
                     }
@@ -117,8 +109,7 @@ public class CompositeELResolver extends
     }
 
     @Override
-    public void setValue(ELContext context, Object base, Object property,
-            Object value) {
+    public void setValue(ELContext context, Object base, Object property, 
Object value) {
         context.setPropertyResolved(false);
         int sz = this.size;
         for (int i = 0; i < sz; i++) {
@@ -133,9 +124,8 @@ public class CompositeELResolver extends
     public boolean isReadOnly(ELContext context, Object base, Object property) 
{
         context.setPropertyResolved(false);
         int sz = this.size;
-        boolean readOnly = false;
         for (int i = 0; i < sz; i++) {
-            readOnly = this.resolvers[i].isReadOnly(context, base, property);
+            boolean readOnly = this.resolvers[i].isReadOnly(context, base, 
property);
             if (context.isPropertyResolved()) {
                 return readOnly;
             }
@@ -150,12 +140,11 @@ public class CompositeELResolver extends
 
     @Override
     public Class<?> getCommonPropertyType(ELContext context, Object base) {
+        Class<?> commonType = null;
         int sz = this.size;
-        Class<?> commonType = null, type = null;
         for (int i = 0; i < sz; i++) {
-            type = this.resolvers[i].getCommonPropertyType(context, base);
-            if (type != null &&
-                    (commonType == null || commonType.isAssignableFrom(type))) 
{
+            Class<?> type = this.resolvers[i].getCommonPropertyType(context, 
base);
+            if (type != null && (commonType == null || 
commonType.isAssignableFrom(type))) {
                 commonType = type;
             }
         }
@@ -166,9 +155,8 @@ public class CompositeELResolver extends
     public Object convertToType(ELContext context, Object obj, Class<?> type) {
         context.setPropertyResolved(false);
         int sz = this.size;
-        Object result = null;
         for (int i = 0; i < sz; i++) {
-            result = this.resolvers[i].convertToType(context, obj, type);
+            Object result = this.resolvers[i].convertToType(context, obj, 
type);
             if (context.isPropertyResolved()) {
                 return result;
             }
@@ -192,8 +180,7 @@ public class CompositeELResolver extends
 
         private FeatureDescriptor next;
 
-        public FeatureIterator(ELContext context, Object base,
-                ELResolver[] resolvers, int size) {
+        public FeatureIterator(ELContext context, Object base, ELResolver[] 
resolvers, int size) {
             this.context = context;
             this.base = base;
             this.resolvers = resolvers;
@@ -205,8 +192,7 @@ public class CompositeELResolver extends
 
         private void guaranteeIterator() {
             while (this.itr == null && this.idx < this.size) {
-                this.itr = this.resolvers[this.idx].getFeatureDescriptors(
-                        this.context, this.base);
+                this.itr = 
this.resolvers[this.idx].getFeatureDescriptors(this.context, this.base);
                 this.idx++;
             }
         }
@@ -231,8 +217,9 @@ public class CompositeELResolver extends
 
         @Override
         public FeatureDescriptor next() {
-            if (!hasNext())
+            if (!hasNext()) {
                 throw new NoSuchElementException();
+            }
             FeatureDescriptor result = this.next;
             this.next = null;
             return result;
@@ -244,5 +231,4 @@ public class CompositeELResolver extends
             throw new UnsupportedOperationException();
         }
     }
-
 }

Modified: tomcat/tc8.0.x/trunk/java/javax/servlet/ServletContext.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/java/javax/servlet/ServletContext.java?rev=1734801&r1=1734800&r2=1734801&view=diff
==============================================================================
--- tomcat/tc8.0.x/trunk/java/javax/servlet/ServletContext.java (original)
+++ tomcat/tc8.0.x/trunk/java/javax/servlet/ServletContext.java Sun Mar 13 
12:46:36 2016
@@ -58,6 +58,13 @@ public interface ServletContext {
      */
     public static final String ORDERED_LIBS = 
"javax.servlet.context.orderedLibs";
 
+    /**
+     * Return the main path associated with this context.
+     *
+     * @return The main context path
+     *
+     * @since Servlet 2.5
+     */
     public String getContextPath();
 
     /**
@@ -560,8 +567,7 @@ public interface ServletContext {
      *    use this method.
      * @since Servlet 3.0
      */
-    public ServletRegistration.Dynamic addServlet(String servletName,
-            String className);
+    public ServletRegistration.Dynamic addServlet(String servletName, String 
className);
 
     /**
      * Register a servlet instance for use in this ServletContext.
@@ -579,14 +585,15 @@ public interface ServletContext {
      *    use this method.
      * @since Servlet 3.0
      */
-    public ServletRegistration.Dynamic addServlet(String servletName,
-            Servlet servlet);
+    public ServletRegistration.Dynamic addServlet(String servletName, Servlet 
servlet);
 
     /**
-     * TODO SERVLET3 - Add comments
-     * @param servletName  TODO
-     * @param servletClass TODO
-     * @return TODO
+     * Add servlet to context.
+     * @param   servletName  Name of servlet to add
+     * @param   servletClass Class of servlet to add
+     * @return  <code>null</code> if the servlet has already been fully 
defined,
+     *          else a {@link javax.servlet.ServletRegistration.Dynamic} object
+     *          that can be used to further configure the servlet
      * @throws IllegalStateException
      *             If the context has already been initialised
      * @throws UnsupportedOperationException    If called from a
@@ -655,10 +662,12 @@ public interface ServletContext {
     public Map<String, ? extends ServletRegistration> 
getServletRegistrations();
 
     /**
-     * TODO SERVLET3 - Add comments
-     * @param filterName TODO
-     * @param className  TODO
-     * @return TODO
+     * Add filter to context.
+     * @param   filterName  Name of filter to add
+     * @param   className Name of filter class
+     * @return  <code>null</code> if the filter has already been fully defined,
+     *          else a {@link javax.servlet.FilterRegistration.Dynamic} object
+     *          that can be used to further configure the filter
      * @throws UnsupportedOperationException    If called from a
      *    {@link 
ServletContextListener#contextInitialized(ServletContextEvent)}
      *    method of a {@link ServletContextListener} that was not defined in a
@@ -670,14 +679,15 @@ public interface ServletContext {
      *             If the context has already been initialised
      * @since Servlet 3.0
      */
-    public FilterRegistration.Dynamic addFilter(String filterName,
-            String className);
+    public FilterRegistration.Dynamic addFilter(String filterName, String 
className);
 
     /**
-     * TODO SERVLET3 - Add comments
-     * @param filterName TODO
-     * @param filter     TODO
-     * @return TODO
+     * Add filter to context.
+     * @param   filterName  Name of filter to add
+     * @param   filter      Filter to add
+     * @return  <code>null</code> if the filter has already been fully defined,
+     *          else a {@link javax.servlet.FilterRegistration.Dynamic} object
+     *          that can be used to further configure the filter
      * @throws UnsupportedOperationException    If called from a
      *    {@link 
ServletContextListener#contextInitialized(ServletContextEvent)}
      *    method of a {@link ServletContextListener} that was not defined in a
@@ -692,10 +702,12 @@ public interface ServletContext {
     public FilterRegistration.Dynamic addFilter(String filterName, Filter 
filter);
 
     /**
-     * TODO SERVLET3 - Add comments
-     * @param filterName  TODO
-     * @param filterClass TODO
-     * @return TODO
+     * Add filter to context.
+     * @param   filterName  Name of filter to add
+     * @param   filterClass Class of filter to add
+     * @return  <code>null</code> if the filter has already been fully defined,
+     *          else a {@link javax.servlet.FilterRegistration.Dynamic} object
+     *          that can be used to further configure the filter
      * @throws UnsupportedOperationException    If called from a
      *    {@link 
ServletContextListener#contextInitialized(ServletContextEvent)}
      *    method of a {@link ServletContextListener} that was not defined in a
@@ -725,8 +737,7 @@ public interface ServletContext {
      * @throws ServletException TODO
      * @since Servlet 3.
      */
-    public <T extends Filter> T createFilter(Class<T> c)
-            throws ServletException;
+    public <T extends Filter> T createFilter(Class<T> c) throws 
ServletException;
 
     /**
      * TODO SERVLET3 - Add comments
@@ -770,8 +781,9 @@ public interface ServletContext {
     public SessionCookieConfig getSessionCookieConfig();
 
     /**
-     * TODO SERVLET3 - Add comments
-     * @param sessionTrackingModes TODO
+     * Configures the available session tracking modes for this web 
application.
+     * @param sessionTrackingModes The session tracking modes to use for this
+     *        web application
      * @throws IllegalArgumentException
      *             If sessionTrackingModes specifies
      *             {@link SessionTrackingMode#SSL} in combination with any 
other
@@ -791,8 +803,15 @@ public interface ServletContext {
             Set<SessionTrackingMode> sessionTrackingModes);
 
     /**
-     * TODO SERVLET3 - Add comments
-     * @return TODO
+     * Obtains the default session tracking modes for this web application.
+     * By default {@link SessionTrackingMode#URL} is always supported, {@link
+     * SessionTrackingMode#COOKIE} is supported unless the <code>cookies</code>
+     * attribute has been set to <code>false</code> for the context and {@link
+     * SessionTrackingMode#SSL} is supported if at least one of the connectors
+     * used by this context has the attribute <code>secure</code> set to
+     * <code>true</code>.
+     * @return The set of default session tracking modes for this web
+     *         application
      * @throws UnsupportedOperationException    If called from a
      *    {@link 
ServletContextListener#contextInitialized(ServletContextEvent)}
      *    method of a {@link ServletContextListener} that was not defined in a
@@ -805,8 +824,10 @@ public interface ServletContext {
     public Set<SessionTrackingMode> getDefaultSessionTrackingModes();
 
     /**
-     * TODO SERVLET3 - Add comments
-     * @return TODO
+     * Obtains the currently enabled session tracking modes for this web
+     * application.
+     * @return The value supplied via {@link #setSessionTrackingModes(Set)} if
+     *         one was previously set, else return the defaults
      * @throws UnsupportedOperationException    If called from a
      *    {@link 
ServletContextListener#contextInitialized(ServletContextEvent)}
      *    method of a {@link ServletContextListener} that was not defined in a

Modified: 
tomcat/tc8.0.x/trunk/java/javax/servlet/jsp/el/ScopedAttributeELResolver.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/java/javax/servlet/jsp/el/ScopedAttributeELResolver.java?rev=1734801&r1=1734800&r2=1734801&view=diff
==============================================================================
--- 
tomcat/tc8.0.x/trunk/java/javax/servlet/jsp/el/ScopedAttributeELResolver.java 
(original)
+++ 
tomcat/tc8.0.x/trunk/java/javax/servlet/jsp/el/ScopedAttributeELResolver.java 
Sun Mar 13 12:46:36 2016
@@ -61,8 +61,7 @@ public class ScopedAttributeELResolver e
             context.setPropertyResolved(base, property);
             if (property != null) {
                 String key = property.toString();
-                PageContext page = (PageContext) context
-                        .getContext(JspContext.class);
+                PageContext page = (PageContext) 
context.getContext(JspContext.class);
                 result = page.findAttribute(key);
 
                 if (result == null) {
@@ -112,8 +111,7 @@ public class ScopedAttributeELResolver e
     }
 
     @Override
-    public Class<Object> getType(ELContext context, Object base,
-            Object property) {
+    public Class<Object> getType(ELContext context, Object base, Object 
property) {
         if (context == null) {
             throw new NullPointerException();
         }
@@ -127,8 +125,7 @@ public class ScopedAttributeELResolver e
     }
 
     @Override
-    public void setValue(ELContext context, Object base, Object property,
-            Object value) {
+    public void setValue(ELContext context, Object base, Object property, 
Object value) {
         if (context == null) {
             throw new NullPointerException();
         }
@@ -137,8 +134,7 @@ public class ScopedAttributeELResolver e
             context.setPropertyResolved(base, property);
             if (property != null) {
                 String key = property.toString();
-                PageContext page = (PageContext) context
-                        .getContext(JspContext.class);
+                PageContext page = (PageContext) 
context.getContext(JspContext.class);
                 int scope = page.getAttributesScope(key);
                 if (scope != 0) {
                     page.setAttribute(key, value, scope);
@@ -163,8 +159,7 @@ public class ScopedAttributeELResolver e
     }
 
     @Override
-    public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context,
-            Object base) {
+    public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext 
context, Object base) {
 
         PageContext ctxt = (PageContext) context.getContext(JspContext.class);
         List<FeatureDescriptor> list = new ArrayList<>();

Modified: tomcat/tc8.0.x/trunk/java/javax/websocket/SendResult.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/java/javax/websocket/SendResult.java?rev=1734801&r1=1734800&r2=1734801&view=diff
==============================================================================
--- tomcat/tc8.0.x/trunk/java/javax/websocket/SendResult.java (original)
+++ tomcat/tc8.0.x/trunk/java/javax/websocket/SendResult.java Sun Mar 13 
12:46:36 2016
@@ -17,16 +17,16 @@
 package javax.websocket;
 
 public final class SendResult {
-    private Throwable exception;
-    private boolean ok = true;
+    private final Throwable exception;
+    private final boolean ok;
 
     public SendResult(Throwable exception) {
         this.exception = exception;
-        this.ok = false;
+        this.ok = (exception == null);
     }
 
     public SendResult() {
-        // NO-OP
+        this (null);
     }
 
     public Throwable getException() {



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to