tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1749868 - in /tomcat/tc8.5.x/trunk: ./ java/javax/el/ java/javax/servlet/jsp/el/ java/org/apache/catalina/core/ java/org/apache/catalina/tribes/tipis/ java/org/apache/jasper/el/ java/org/apache/tomcat/util/collections/ java/org/apache/tomc...
Date Thu, 23 Jun 2016 11:33:20 GMT
Author: markt
Date: Thu Jun 23 11:33:20 2016
New Revision: 1749868

URL: http://svn.apache.org/viewvc?rev=1749868&view=rev
Log:
Use Objects.requireNonNull() to simplify code

Modified:
    tomcat/tc8.5.x/trunk/   (props changed)
    tomcat/tc8.5.x/trunk/java/javax/el/ArrayELResolver.java
    tomcat/tc8.5.x/trunk/java/javax/el/BeanELResolver.java
    tomcat/tc8.5.x/trunk/java/javax/el/BeanNameELResolver.java
    tomcat/tc8.5.x/trunk/java/javax/el/CompositeELResolver.java
    tomcat/tc8.5.x/trunk/java/javax/el/ELContext.java
    tomcat/tc8.5.x/trunk/java/javax/el/LambdaExpression.java
    tomcat/tc8.5.x/trunk/java/javax/el/ListELResolver.java
    tomcat/tc8.5.x/trunk/java/javax/el/MapELResolver.java
    tomcat/tc8.5.x/trunk/java/javax/el/ResourceBundleELResolver.java
    tomcat/tc8.5.x/trunk/java/javax/el/StaticFieldELResolver.java
    tomcat/tc8.5.x/trunk/java/javax/servlet/jsp/el/ImplicitObjectELResolver.java
    tomcat/tc8.5.x/trunk/java/javax/servlet/jsp/el/ScopedAttributeELResolver.java
    tomcat/tc8.5.x/trunk/java/org/apache/catalina/core/AccessLogAdapter.java
    tomcat/tc8.5.x/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java
    tomcat/tc8.5.x/trunk/java/org/apache/jasper/el/ELResolverImpl.java
    tomcat/tc8.5.x/trunk/java/org/apache/tomcat/util/collections/ManagedConcurrentWeakHashMap.java
    tomcat/tc8.5.x/trunk/java/org/apache/tomcat/util/net/SocketProcessorBase.java
    tomcat/tc8.5.x/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/Room.java

Propchange: tomcat/tc8.5.x/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Jun 23 11:33:20 2016
@@ -1 +1 @@
-/tomcat/trunk:1734785,1734799,1734845,1734928,1735041,1735044,1735480,1735577,1735597,1735599-1735600,1735615,1736145,1736162,1736209,1736280,1736297,1736299,1736489,1736646,1736703,1736836,1736849,1737104-1737105,1737112,1737117,1737119-1737120,1737155,1737157,1737192,1737280,1737339,1737632,1737664,1737715,1737748,1737785,1737834,1737860,1737903,1737959,1738005,1738007,1738014-1738015,1738018,1738022,1738039,1738043,1738059-1738060,1738147,1738149,1738174-1738175,1738261,1738589,1738623-1738625,1738643,1738816,1738850,1738855,1738946-1738948,1738953-1738954,1738979,1738982,1739079-1739081,1739087,1739113,1739153,1739172,1739176,1739191,1739474,1739726,1739762,1739775,1739814,1739817-1739818,1739975,1740131,1740324,1740465,1740495,1740508-1740509,1740520,1740535,1740707,1740803,1740810,1740969,1740980,1740991,1740997,1741015,1741033,1741036,1741058,1741060,1741080,1741147,1741159,1741164,1741173,1741181,1741190,1741197,1741202,1741208,1741213,1741221,1741225,1741232,1741409,1741501
 ,1741677,1741892,1741896,1741984,1742023,1742042,1742071,1742090,1742093,1742101,1742105,1742111,1742139,1742146,1742148,1742166,1742181,1742184,1742187,1742246,1742248-1742251,1742263-1742264,1742268,1742276,1742369,1742387,1742448,1742509-1742512,1742917,1742919,1742933,1742975-1742976,1742984,1742986,1743019,1743115,1743117,1743124-1743125,1743134,1743425,1743554,1743679,1743696-1743698,1743700-1743701,1744058,1744064-1744065,1744125,1744194,1744229,1744270,1744323,1744432,1744684,1744697,1744705,1744713,1744760,1744786,1745142-1745143,1745145,1745177,1745179-1745180,1745227,1745248,1745254,1745337,1745467,1745576,1745735,1745744,1746304,1746306-1746307,1746319,1746327,1746338,1746340-1746341,1746344,1746427,1746441,1746473,1746490,1746492,1746495-1746496,1746499-1746501,1746503-1746507,1746509,1746549,1746551,1746554,1746556,1746558,1746584,1746620,1746649,1746724,1746939,1746989,1747014,1747028,1747035,1747210,1747225,1747234,1747253,1747404,1747506,1747536,1747924,1747980,1747
 993,1748001,1748253,1748452,1748547,1748629,1748676,1748715,1749287,1749296,1749328,1749373,1749465,1749506,1749508,1749665-1749666,1749763
+/tomcat/trunk:1734785,1734799,1734845,1734928,1735041,1735044,1735480,1735577,1735597,1735599-1735600,1735615,1736145,1736162,1736209,1736280,1736297,1736299,1736489,1736646,1736703,1736836,1736849,1737104-1737105,1737112,1737117,1737119-1737120,1737155,1737157,1737192,1737280,1737339,1737632,1737664,1737715,1737748,1737785,1737834,1737860,1737903,1737959,1738005,1738007,1738014-1738015,1738018,1738022,1738039,1738043,1738059-1738060,1738147,1738149,1738174-1738175,1738261,1738589,1738623-1738625,1738643,1738816,1738850,1738855,1738946-1738948,1738953-1738954,1738979,1738982,1739079-1739081,1739087,1739113,1739153,1739172,1739176,1739191,1739474,1739726,1739762,1739775,1739814,1739817-1739818,1739975,1740131,1740324,1740465,1740495,1740508-1740509,1740520,1740535,1740707,1740803,1740810,1740969,1740980,1740991,1740997,1741015,1741033,1741036,1741058,1741060,1741080,1741147,1741159,1741164,1741173,1741181,1741190,1741197,1741202,1741208,1741213,1741221,1741225,1741232,1741409,1741501
 ,1741677,1741892,1741896,1741984,1742023,1742042,1742071,1742090,1742093,1742101,1742105,1742111,1742139,1742146,1742148,1742166,1742181,1742184,1742187,1742246,1742248-1742251,1742263-1742264,1742268,1742276,1742369,1742387,1742448,1742509-1742512,1742917,1742919,1742933,1742975-1742976,1742984,1742986,1743019,1743115,1743117,1743124-1743125,1743134,1743425,1743554,1743679,1743696-1743698,1743700-1743701,1744058,1744064-1744065,1744125,1744194,1744229,1744270,1744323,1744432,1744684,1744697,1744705,1744713,1744760,1744786,1745142-1745143,1745145,1745177,1745179-1745180,1745227,1745248,1745254,1745337,1745467,1745576,1745735,1745744,1746304,1746306-1746307,1746319,1746327,1746338,1746340-1746341,1746344,1746427,1746441,1746473,1746490,1746492,1746495-1746496,1746499-1746501,1746503-1746507,1746509,1746549,1746551,1746554,1746556,1746558,1746584,1746620,1746649,1746724,1746939,1746989,1747014,1747028,1747035,1747210,1747225,1747234,1747253,1747404,1747506,1747536,1747924,1747980,1747
 993,1748001,1748253,1748452,1748547,1748629,1748676,1748715,1749287,1749296,1749328,1749373,1749465,1749506,1749508,1749665-1749666,1749763,1749865-1749866

Modified: tomcat/tc8.5.x/trunk/java/javax/el/ArrayELResolver.java
URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/javax/el/ArrayELResolver.java?rev=1749868&r1=1749867&r2=1749868&view=diff
==============================================================================
--- tomcat/tc8.5.x/trunk/java/javax/el/ArrayELResolver.java (original)
+++ tomcat/tc8.5.x/trunk/java/javax/el/ArrayELResolver.java Thu Jun 23 11:33:20 2016
@@ -20,6 +20,7 @@ package javax.el;
 import java.beans.FeatureDescriptor;
 import java.lang.reflect.Array;
 import java.util.Iterator;
+import java.util.Objects;
 
 public class ArrayELResolver extends ELResolver {
 
@@ -35,9 +36,7 @@ public class ArrayELResolver extends ELR
 
     @Override
     public Class<?> getType(ELContext context, Object base, Object property) {
-        if (context == null) {
-            throw new NullPointerException();
-        }
+        Objects.requireNonNull(context);
 
         if (base != null && base.getClass().isArray()) {
             context.setPropertyResolved(base, property);
@@ -55,9 +54,7 @@ public class ArrayELResolver extends ELR
 
     @Override
     public Object getValue(ELContext context, Object base, Object property) {
-        if (context == null) {
-            throw new NullPointerException();
-        }
+        Objects.requireNonNull(context);
 
         if (base != null && base.getClass().isArray()) {
             context.setPropertyResolved(base, property);
@@ -74,9 +71,7 @@ public class ArrayELResolver extends ELR
     @Override
     public void setValue(ELContext context, Object base, Object property,
             Object value) {
-        if (context == null) {
-            throw new NullPointerException();
-        }
+        Objects.requireNonNull(context);
 
         if (base != null && base.getClass().isArray()) {
             context.setPropertyResolved(base, property);
@@ -100,9 +95,7 @@ public class ArrayELResolver extends ELR
 
     @Override
     public boolean isReadOnly(ELContext context, Object base, Object property) {
-        if (context == null) {
-            throw new NullPointerException();
-        }
+        Objects.requireNonNull(context);
 
         if (base != null && base.getClass().isArray()) {
             context.setPropertyResolved(base, property);

Modified: tomcat/tc8.5.x/trunk/java/javax/el/BeanELResolver.java
URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/javax/el/BeanELResolver.java?rev=1749868&r1=1749867&r2=1749868&view=diff
==============================================================================
--- tomcat/tc8.5.x/trunk/java/javax/el/BeanELResolver.java (original)
+++ tomcat/tc8.5.x/trunk/java/javax/el/BeanELResolver.java Thu Jun 23 11:33:20 2016
@@ -30,6 +30,7 @@ import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
+import java.util.Objects;
 import java.util.WeakHashMap;
 import java.util.concurrent.ConcurrentHashMap;
 
@@ -71,9 +72,7 @@ public class BeanELResolver extends ELRe
 
     @Override
     public Class<?> getType(ELContext context, Object base, Object property) {
-        if (context == null) {
-            throw new NullPointerException();
-        }
+        Objects.requireNonNull(context);
         if (base == null || property == null) {
             return null;
         }
@@ -84,9 +83,7 @@ public class BeanELResolver extends ELRe
 
     @Override
     public Object getValue(ELContext context, Object base, Object property) {
-        if (context == null) {
-            throw new NullPointerException();
-        }
+        Objects.requireNonNull(context);
         if (base == null || property == null) {
             return null;
         }
@@ -108,9 +105,7 @@ public class BeanELResolver extends ELRe
     @Override
     public void setValue(ELContext context, Object base, Object property,
             Object value) {
-        if (context == null) {
-            throw new NullPointerException();
-        }
+        Objects.requireNonNull(context);
         if (base == null || property == null) {
             return;
         }
@@ -141,9 +136,7 @@ public class BeanELResolver extends ELRe
     @Override
     public Object invoke(ELContext context, Object base, Object method,
             Class<?>[] paramTypes, Object[] params) {
-        if (context == null) {
-            throw new NullPointerException();
-        }
+        Objects.requireNonNull(context);
         if (base == null || method == null) {
             return null;
         }
@@ -177,9 +170,7 @@ public class BeanELResolver extends ELRe
 
     @Override
     public boolean isReadOnly(ELContext context, Object base, Object property) {
-        if (context == null) {
-            throw new NullPointerException();
-        }
+        Objects.requireNonNull(context);
         if (base == null || property == null) {
             return false;
         }

Modified: tomcat/tc8.5.x/trunk/java/javax/el/BeanNameELResolver.java
URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/javax/el/BeanNameELResolver.java?rev=1749868&r1=1749867&r2=1749868&view=diff
==============================================================================
--- tomcat/tc8.5.x/trunk/java/javax/el/BeanNameELResolver.java (original)
+++ tomcat/tc8.5.x/trunk/java/javax/el/BeanNameELResolver.java Thu Jun 23 11:33:20 2016
@@ -18,6 +18,7 @@ package javax.el;
 
 import java.beans.FeatureDescriptor;
 import java.util.Iterator;
+import java.util.Objects;
 
 /**
  * @since EL 3.0
@@ -32,10 +33,7 @@ public class BeanNameELResolver extends
 
     @Override
     public Object getValue(ELContext context, Object base, Object property) {
-
-        if (context == null) {
-            throw new NullPointerException();
-        }
+        Objects.requireNonNull(context);
         if (base != null || !(property instanceof String)) {
             return null;
         }
@@ -59,10 +57,7 @@ public class BeanNameELResolver extends
     @Override
     public void setValue(ELContext context, Object base, Object property,
             Object value) {
-
-        if (context == null) {
-            throw new NullPointerException();
-        }
+        Objects.requireNonNull(context);
         if (base != null || !(property instanceof String)) {
             return;
         }
@@ -100,10 +95,7 @@ public class BeanNameELResolver extends
 
     @Override
     public Class<?> getType(ELContext context, Object base, Object property) {
-
-        if (context == null) {
-            throw new NullPointerException();
-        }
+        Objects.requireNonNull(context);
         if (base != null || !(property instanceof String)) {
             return null;
         }
@@ -126,10 +118,7 @@ public class BeanNameELResolver extends
 
     @Override
     public boolean isReadOnly(ELContext context, Object base, Object property) {
-
-        if (context == null) {
-            throw new NullPointerException();
-        }
+        Objects.requireNonNull(context);
         if (base != null || !(property instanceof String)) {
             // Return value undefined
             return false;

Modified: tomcat/tc8.5.x/trunk/java/javax/el/CompositeELResolver.java
URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/javax/el/CompositeELResolver.java?rev=1749868&r1=1749867&r2=1749868&view=diff
==============================================================================
--- tomcat/tc8.5.x/trunk/java/javax/el/CompositeELResolver.java (original)
+++ tomcat/tc8.5.x/trunk/java/javax/el/CompositeELResolver.java Thu Jun 23 11:33:20 2016
@@ -19,6 +19,7 @@ package javax.el;
 import java.beans.FeatureDescriptor;
 import java.util.Iterator;
 import java.util.NoSuchElementException;
+import java.util.Objects;
 
 public class CompositeELResolver extends ELResolver {
 
@@ -43,9 +44,7 @@ public class CompositeELResolver extends
     }
 
     public void add(ELResolver elResolver) {
-        if (elResolver == null) {
-            throw new NullPointerException();
-        }
+        Objects.requireNonNull(elResolver);
 
         if (this.size >= this.resolvers.length) {
             ELResolver[] nr = new ELResolver[this.size * 2];

Modified: tomcat/tc8.5.x/trunk/java/javax/el/ELContext.java
URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/javax/el/ELContext.java?rev=1749868&r1=1749867&r2=1749868&view=diff
==============================================================================
--- tomcat/tc8.5.x/trunk/java/javax/el/ELContext.java (original)
+++ tomcat/tc8.5.x/trunk/java/javax/el/ELContext.java Thu Jun 23 11:33:20 2016
@@ -23,6 +23,7 @@ import java.util.LinkedList;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
+import java.util.Objects;
 
 public abstract class ELContext {
 
@@ -75,9 +76,8 @@ public abstract class ELContext {
      */
     public void putContext(@SuppressWarnings("rawtypes") Class key,
             Object contextObject) {
-        if (key == null || contextObject == null) {
-            throw new NullPointerException();
-        }
+        Objects.requireNonNull(key);
+        Objects.requireNonNull(contextObject);
 
         if (this.map == null) {
             this.map = new HashMap<>();
@@ -98,9 +98,7 @@ public abstract class ELContext {
      *              If the supplied key is <code>null</code>
      */
     public Object getContext(@SuppressWarnings("rawtypes") Class key) {
-        if (key == null) {
-            throw new NullPointerException();
-        }
+        Objects.requireNonNull(key);
         if (this.map == null) {
             return null;
         }

Modified: tomcat/tc8.5.x/trunk/java/javax/el/LambdaExpression.java
URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/javax/el/LambdaExpression.java?rev=1749868&r1=1749867&r2=1749868&view=diff
==============================================================================
--- tomcat/tc8.5.x/trunk/java/javax/el/LambdaExpression.java (original)
+++ tomcat/tc8.5.x/trunk/java/javax/el/LambdaExpression.java Thu Jun 23 11:33:20 2016
@@ -19,6 +19,7 @@ package javax.el;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 
 public class LambdaExpression {
 
@@ -42,9 +43,7 @@ public class LambdaExpression {
     public Object invoke(ELContext context, Object... args)
             throws ELException {
 
-        if (context == null) {
-            throw new NullPointerException();
-        }
+        Objects.requireNonNull(context);
 
         int formalParamCount = 0;
         if (formalParameters != null) {

Modified: tomcat/tc8.5.x/trunk/java/javax/el/ListELResolver.java
URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/javax/el/ListELResolver.java?rev=1749868&r1=1749867&r2=1749868&view=diff
==============================================================================
--- tomcat/tc8.5.x/trunk/java/javax/el/ListELResolver.java (original)
+++ tomcat/tc8.5.x/trunk/java/javax/el/ListELResolver.java Thu Jun 23 11:33:20 2016
@@ -22,6 +22,7 @@ import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Objects;
 
 public class ListELResolver extends ELResolver {
 
@@ -40,9 +41,7 @@ public class ListELResolver extends ELRe
 
     @Override
     public Class<?> getType(ELContext context, Object base, Object property) {
-        if (context == null) {
-            throw new NullPointerException();
-        }
+        Objects.requireNonNull(context);
 
         if (base instanceof List<?>) {
             context.setPropertyResolved(base, property);
@@ -60,9 +59,7 @@ public class ListELResolver extends ELRe
 
     @Override
     public Object getValue(ELContext context, Object base, Object property) {
-        if (context == null) {
-            throw new NullPointerException();
-        }
+        Objects.requireNonNull(context);
 
         if (base instanceof List<?>) {
             context.setPropertyResolved(base, property);
@@ -80,9 +77,7 @@ public class ListELResolver extends ELRe
     @Override
     public void setValue(ELContext context, Object base, Object property,
             Object value) {
-        if (context == null) {
-            throw new NullPointerException();
-        }
+        Objects.requireNonNull(context);
 
         if (base instanceof List<?>) {
             context.setPropertyResolved(base, property);
@@ -107,9 +102,7 @@ public class ListELResolver extends ELRe
 
     @Override
     public boolean isReadOnly(ELContext context, Object base, Object property) {
-        if (context == null) {
-            throw new NullPointerException();
-        }
+        Objects.requireNonNull(context);
 
         if (base instanceof List<?>) {
             context.setPropertyResolved(base, property);

Modified: tomcat/tc8.5.x/trunk/java/javax/el/MapELResolver.java
URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/javax/el/MapELResolver.java?rev=1749868&r1=1749867&r2=1749868&view=diff
==============================================================================
--- tomcat/tc8.5.x/trunk/java/javax/el/MapELResolver.java (original)
+++ tomcat/tc8.5.x/trunk/java/javax/el/MapELResolver.java Thu Jun 23 11:33:20 2016
@@ -24,6 +24,7 @@ import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 
 public class MapELResolver extends ELResolver {
 
@@ -42,9 +43,7 @@ public class MapELResolver extends ELRes
 
     @Override
     public Class<?> getType(ELContext context, Object base, Object property) {
-        if (context == null) {
-            throw new NullPointerException();
-        }
+        Objects.requireNonNull(context);
 
         if (base instanceof Map<?,?>) {
             context.setPropertyResolved(base, property);
@@ -56,9 +55,7 @@ public class MapELResolver extends ELRes
 
     @Override
     public Object getValue(ELContext context, Object base, Object property) {
-        if (context == null) {
-            throw new NullPointerException();
-        }
+        Objects.requireNonNull(context);
 
         if (base instanceof Map<?,?>) {
             context.setPropertyResolved(base, property);
@@ -71,9 +68,7 @@ public class MapELResolver extends ELRes
     @Override
     public void setValue(ELContext context, Object base, Object property,
             Object value) {
-        if (context == null) {
-            throw new NullPointerException();
-        }
+        Objects.requireNonNull(context);
 
         if (base instanceof Map<?, ?>) {
             context.setPropertyResolved(base, property);
@@ -95,9 +90,7 @@ public class MapELResolver extends ELRes
 
     @Override
     public boolean isReadOnly(ELContext context, Object base, Object property) {
-        if (context == null) {
-            throw new NullPointerException();
-        }
+        Objects.requireNonNull(context);
 
         if (base instanceof Map<?, ?>) {
             context.setPropertyResolved(base, property);

Modified: tomcat/tc8.5.x/trunk/java/javax/el/ResourceBundleELResolver.java
URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/javax/el/ResourceBundleELResolver.java?rev=1749868&r1=1749867&r2=1749868&view=diff
==============================================================================
--- tomcat/tc8.5.x/trunk/java/javax/el/ResourceBundleELResolver.java (original)
+++ tomcat/tc8.5.x/trunk/java/javax/el/ResourceBundleELResolver.java Thu Jun 23 11:33:20 2016
@@ -23,6 +23,7 @@ import java.util.Enumeration;
 import java.util.Iterator;
 import java.util.List;
 import java.util.MissingResourceException;
+import java.util.Objects;
 import java.util.ResourceBundle;
 
 public class ResourceBundleELResolver extends ELResolver {
@@ -33,10 +34,7 @@ public class ResourceBundleELResolver ex
 
     @Override
     public Object getValue(ELContext context, Object base, Object property) {
-
-        if (context == null) {
-            throw new NullPointerException();
-        }
+        Objects.requireNonNull(context);
 
         if (base instanceof ResourceBundle) {
             context.setPropertyResolved(base, property);
@@ -56,9 +54,7 @@ public class ResourceBundleELResolver ex
 
     @Override
     public Class<?> getType(ELContext context, Object base, Object property) {
-        if (context == null) {
-            throw new NullPointerException();
-        }
+        Objects.requireNonNull(context);
 
         if (base instanceof ResourceBundle) {
             context.setPropertyResolved(base, property);
@@ -70,9 +66,7 @@ public class ResourceBundleELResolver ex
     @Override
     public void setValue(ELContext context, Object base, Object property,
             Object value) {
-        if (context == null) {
-            throw new NullPointerException();
-        }
+        Objects.requireNonNull(context);
 
         if (base instanceof ResourceBundle) {
             context.setPropertyResolved(base, property);
@@ -83,9 +77,7 @@ public class ResourceBundleELResolver ex
 
     @Override
     public boolean isReadOnly(ELContext context, Object base, Object property) {
-        if (context == null) {
-            throw new NullPointerException();
-        }
+        Objects.requireNonNull(context);
 
         if (base instanceof ResourceBundle) {
             context.setPropertyResolved(base, property);

Modified: tomcat/tc8.5.x/trunk/java/javax/el/StaticFieldELResolver.java
URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/javax/el/StaticFieldELResolver.java?rev=1749868&r1=1749867&r2=1749868&view=diff
==============================================================================
--- tomcat/tc8.5.x/trunk/java/javax/el/StaticFieldELResolver.java (original)
+++ tomcat/tc8.5.x/trunk/java/javax/el/StaticFieldELResolver.java Thu Jun 23 11:33:20 2016
@@ -23,6 +23,7 @@ import java.lang.reflect.InvocationTarge
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
 import java.util.Iterator;
+import java.util.Objects;
 
 /**
  * @since EL 3.0
@@ -31,10 +32,7 @@ public class StaticFieldELResolver exten
 
     @Override
     public Object getValue(ELContext context, Object base, Object property) {
-
-        if (context == null) {
-            throw new NullPointerException();
-        }
+        Objects.requireNonNull(context);
 
         if (base instanceof ELClass && property instanceof String) {
             context.setPropertyResolved(base, property);
@@ -68,10 +66,7 @@ public class StaticFieldELResolver exten
     @Override
     public void setValue(ELContext context, Object base, Object property,
             Object value) {
-
-        if (context == null) {
-            throw new NullPointerException();
-        }
+        Objects.requireNonNull(context);
 
         if (base instanceof ELClass && property instanceof String) {
             Class<?> clazz = ((ELClass) base).getKlass();
@@ -87,10 +82,7 @@ public class StaticFieldELResolver exten
     @Override
     public Object invoke(ELContext context, Object base, Object method,
             Class<?>[] paramTypes, Object[] params) {
-
-        if (context == null) {
-            throw new NullPointerException();
-        }
+        Objects.requireNonNull(context);
 
         if (base instanceof ELClass && method instanceof String) {
             context.setPropertyResolved(base, method);
@@ -151,9 +143,7 @@ public class StaticFieldELResolver exten
 
     @Override
     public Class<?> getType(ELContext context, Object base, Object property) {
-        if (context == null) {
-            throw new NullPointerException();
-        }
+        Objects.requireNonNull(context);
 
         if (base instanceof ELClass && property instanceof String) {
             context.setPropertyResolved(base, property);
@@ -186,9 +176,7 @@ public class StaticFieldELResolver exten
 
     @Override
     public boolean isReadOnly(ELContext context, Object base, Object property) {
-        if (context == null) {
-            throw new NullPointerException();
-        }
+        Objects.requireNonNull(context);
 
         if (base instanceof ELClass && property instanceof String) {
             context.setPropertyResolved(base, property);

Modified: tomcat/tc8.5.x/trunk/java/javax/servlet/jsp/el/ImplicitObjectELResolver.java
URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/javax/servlet/jsp/el/ImplicitObjectELResolver.java?rev=1749868&r1=1749867&r2=1749868&view=diff
==============================================================================
--- tomcat/tc8.5.x/trunk/java/javax/servlet/jsp/el/ImplicitObjectELResolver.java (original)
+++ tomcat/tc8.5.x/trunk/java/javax/servlet/jsp/el/ImplicitObjectELResolver.java Thu Jun 23
11:33:20 2016
@@ -26,6 +26,7 @@ import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 import java.util.Set;
 import java.util.Vector;
 
@@ -77,9 +78,7 @@ public class ImplicitObjectELResolver ex
 
     @Override
     public Object getValue(ELContext context, Object base, Object property) {
-        if (context == null) {
-            throw new NullPointerException();
-        }
+        Objects.requireNonNull(context);
 
         if (base == null && property != null) {
             int idx = Arrays.binarySearch(SCOPE_NAMES, property.toString());
@@ -120,9 +119,7 @@ public class ImplicitObjectELResolver ex
     @Override
     @SuppressWarnings({ "unchecked", "rawtypes" }) // TCK signature test fails with generics
     public Class getType(ELContext context, Object base, Object property) {
-        if (context == null) {
-            throw new NullPointerException();
-        }
+        Objects.requireNonNull(context);
 
         if (base == null && property != null) {
             int idx = Arrays.binarySearch(SCOPE_NAMES, property.toString());
@@ -136,9 +133,7 @@ public class ImplicitObjectELResolver ex
     @Override
     public void setValue(ELContext context, Object base, Object property,
             Object value) {
-        if (context == null) {
-            throw new NullPointerException();
-        }
+        Objects.requireNonNull(context);
 
         if (base == null && property != null) {
             int idx = Arrays.binarySearch(SCOPE_NAMES, property.toString());
@@ -151,9 +146,7 @@ public class ImplicitObjectELResolver ex
 
     @Override
     public boolean isReadOnly(ELContext context, Object base, Object property) {
-        if (context == null) {
-            throw new NullPointerException();
-        }
+        Objects.requireNonNull(context);
 
         if (base == null && property != null) {
             int idx = Arrays.binarySearch(SCOPE_NAMES, property.toString());
@@ -597,9 +590,7 @@ public class ImplicitObjectELResolver ex
 
         @Override
         public final V put(String key, V value) {
-            if (key == null) {
-                throw new NullPointerException();
-            }
+            Objects.requireNonNull(key);
             if (value == null) {
                 this.removeAttribute(key);
             } else {
@@ -610,13 +601,9 @@ public class ImplicitObjectELResolver ex
 
         @Override
         public final V remove(Object key) {
-            if (key == null) {
-                throw new NullPointerException();
-            }
+            Objects.requireNonNull(key);
             this.removeAttribute((String) key);
             return null;
         }
-
     }
-
 }

Modified: tomcat/tc8.5.x/trunk/java/javax/servlet/jsp/el/ScopedAttributeELResolver.java
URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/javax/servlet/jsp/el/ScopedAttributeELResolver.java?rev=1749868&r1=1749867&r2=1749868&view=diff
==============================================================================
--- tomcat/tc8.5.x/trunk/java/javax/servlet/jsp/el/ScopedAttributeELResolver.java (original)
+++ tomcat/tc8.5.x/trunk/java/javax/servlet/jsp/el/ScopedAttributeELResolver.java Thu Jun
23 11:33:20 2016
@@ -21,6 +21,7 @@ import java.util.ArrayList;
 import java.util.Enumeration;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Objects;
 
 import javax.el.ELClass;
 import javax.el.ELContext;
@@ -51,9 +52,7 @@ public class ScopedAttributeELResolver e
 
     @Override
     public Object getValue(ELContext context, Object base, Object property) {
-        if (context == null) {
-            throw new NullPointerException();
-        }
+        Objects.requireNonNull(context);
 
         Object result = null;
 
@@ -112,9 +111,7 @@ public class ScopedAttributeELResolver e
 
     @Override
     public Class<Object> getType(ELContext context, Object base, Object property) {
-        if (context == null) {
-            throw new NullPointerException();
-        }
+        Objects.requireNonNull(context);
 
         if (base == null) {
             context.setPropertyResolved(base, property);
@@ -126,9 +123,7 @@ public class ScopedAttributeELResolver e
 
     @Override
     public void setValue(ELContext context, Object base, Object property, Object value) {
-        if (context == null) {
-            throw new NullPointerException();
-        }
+        Objects.requireNonNull(context);
 
         if (base == null) {
             context.setPropertyResolved(base, property);
@@ -147,9 +142,7 @@ public class ScopedAttributeELResolver e
 
     @Override
     public boolean isReadOnly(ELContext context, Object base, Object property) {
-        if (context == null) {
-            throw new NullPointerException();
-        }
+        Objects.requireNonNull(context);
 
         if (base == null) {
             context.setPropertyResolved(base, property);

Modified: tomcat/tc8.5.x/trunk/java/org/apache/catalina/core/AccessLogAdapter.java
URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/org/apache/catalina/core/AccessLogAdapter.java?rev=1749868&r1=1749867&r2=1749868&view=diff
==============================================================================
--- tomcat/tc8.5.x/trunk/java/org/apache/catalina/core/AccessLogAdapter.java (original)
+++ tomcat/tc8.5.x/trunk/java/org/apache/catalina/core/AccessLogAdapter.java Thu Jun 23 11:33:20
2016
@@ -17,6 +17,7 @@
 package org.apache.catalina.core;
 
 import java.util.Arrays;
+import java.util.Objects;
 
 import org.apache.catalina.AccessLog;
 import org.apache.catalina.connector.Request;
@@ -30,16 +31,12 @@ public class AccessLogAdapter implements
     private AccessLog[] logs;
 
     public AccessLogAdapter(AccessLog log) {
-        if (log == null) {
-            throw new NullPointerException();
-        }
+        Objects.requireNonNull(log);
         logs = new AccessLog[] { log };
     }
 
     public void add(AccessLog log) {
-        if (log == null) {
-            throw new NullPointerException();
-        }
+        Objects.requireNonNull(log);
         AccessLog newArray[] = Arrays.copyOf(logs, logs.length + 1);
         newArray[newArray.length - 1] = log;
         logs = newArray;

Modified: tomcat/tc8.5.x/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java
URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java?rev=1749868&r1=1749867&r2=1749868&view=diff
==============================================================================
--- tomcat/tc8.5.x/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java
(original)
+++ tomcat/tc8.5.x/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java
Thu Jun 23 11:33:20 2016
@@ -27,6 +27,7 @@ import java.util.HashMap;
 import java.util.Iterator;
 import java.util.LinkedHashSet;
 import java.util.Map;
+import java.util.Objects;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
@@ -1121,9 +1122,7 @@ public abstract class AbstractReplicated
 
     @Override
     public boolean containsValue(Object value) {
-        if (value == null) {
-            throw new NullPointerException();
-        }
+        Objects.requireNonNull(value);
         Iterator<Map.Entry<K,MapEntry<K,V>>> i = innerMap.entrySet().iterator();
         while (i.hasNext()) {
             Map.Entry<K,MapEntry<K,V>> e = i.next();

Modified: tomcat/tc8.5.x/trunk/java/org/apache/jasper/el/ELResolverImpl.java
URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/org/apache/jasper/el/ELResolverImpl.java?rev=1749868&r1=1749867&r2=1749868&view=diff
==============================================================================
--- tomcat/tc8.5.x/trunk/java/org/apache/jasper/el/ELResolverImpl.java (original)
+++ tomcat/tc8.5.x/trunk/java/org/apache/jasper/el/ELResolverImpl.java Thu Jun 23 11:33:20
2016
@@ -18,6 +18,7 @@
 package org.apache.jasper.el;
 
 import java.util.Iterator;
+import java.util.Objects;
 
 import javax.el.ELContext;
 import javax.el.ELException;
@@ -40,9 +41,7 @@ public final class ELResolverImpl extend
 
     @Override
     public Object getValue(ELContext context, Object base, Object property) {
-        if (context == null) {
-            throw new NullPointerException();
-        }
+        Objects.requireNonNull(context);
 
         if (base == null) {
             context.setPropertyResolved(base, property);
@@ -64,9 +63,7 @@ public final class ELResolverImpl extend
 
     @Override
     public Class<?> getType(ELContext context, Object base, Object property) {
-        if (context == null) {
-            throw new NullPointerException();
-        }
+        Objects.requireNonNull(context);
 
         if (base == null) {
             context.setPropertyResolved(base, property);
@@ -90,9 +87,7 @@ public final class ELResolverImpl extend
     @Override
     public void setValue(ELContext context, Object base, Object property,
             Object value) {
-        if (context == null) {
-            throw new NullPointerException();
-        }
+        Objects.requireNonNull(context);
 
         if (base == null) {
             context.setPropertyResolved(base, property);
@@ -107,9 +102,7 @@ public final class ELResolverImpl extend
 
     @Override
     public boolean isReadOnly(ELContext context, Object base, Object property) {
-        if (context == null) {
-            throw new NullPointerException();
-        }
+        Objects.requireNonNull(context);
 
         if (base == null) {
             context.setPropertyResolved(base, property);

Modified: tomcat/tc8.5.x/trunk/java/org/apache/tomcat/util/collections/ManagedConcurrentWeakHashMap.java
URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/org/apache/tomcat/util/collections/ManagedConcurrentWeakHashMap.java?rev=1749868&r1=1749867&r2=1749868&view=diff
==============================================================================
--- tomcat/tc8.5.x/trunk/java/org/apache/tomcat/util/collections/ManagedConcurrentWeakHashMap.java
(original)
+++ tomcat/tc8.5.x/trunk/java/org/apache/tomcat/util/collections/ManagedConcurrentWeakHashMap.java
Thu Jun 23 11:33:20 2016
@@ -24,6 +24,7 @@ import java.util.AbstractSet;
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.Map;
+import java.util.Objects;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
@@ -122,12 +123,6 @@ public class ManagedConcurrentWeakHashMa
         return new Key(key, null);
     }
 
-    private static void checkNotNull(Object value) {
-        if (value == null) {
-            throw new NullPointerException();
-        }
-    }
-
     @Override
     public int size() {
         return map.size();
@@ -164,7 +159,7 @@ public class ManagedConcurrentWeakHashMa
 
     @Override
     public V put(K key, V value) {
-        checkNotNull(value);
+        Objects.requireNonNull(value);
         return map.put(createStoreKey(key), value);
     }
 
@@ -183,7 +178,7 @@ public class ManagedConcurrentWeakHashMa
 
     @Override
     public V putIfAbsent(K key, V value) {
-        checkNotNull(value);
+        Objects.requireNonNull(value);
         Key storeKey = createStoreKey(key);
         V oldValue = map.putIfAbsent(storeKey, value);
         if (oldValue != null) { // ack that key has not been stored
@@ -202,13 +197,13 @@ public class ManagedConcurrentWeakHashMa
 
     @Override
     public boolean replace(K key, V oldValue, V newValue) {
-        checkNotNull(newValue);
+        Objects.requireNonNull(newValue);
         return map.replace(createLookupKey(key), oldValue, newValue);
     }
 
     @Override
     public V replace(K key, V value) {
-        checkNotNull(value);
+        Objects.requireNonNull(value);
         return map.replace(createLookupKey(key), value);
     }
 
@@ -259,7 +254,7 @@ public class ManagedConcurrentWeakHashMa
 
                             @Override
                             public V setValue(V value) {
-                                checkNotNull(value);
+                                Objects.requireNonNull(value);
                                 return en.setValue(value);
                             }
                         };

Modified: tomcat/tc8.5.x/trunk/java/org/apache/tomcat/util/net/SocketProcessorBase.java
URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/org/apache/tomcat/util/net/SocketProcessorBase.java?rev=1749868&r1=1749867&r2=1749868&view=diff
==============================================================================
--- tomcat/tc8.5.x/trunk/java/org/apache/tomcat/util/net/SocketProcessorBase.java (original)
+++ tomcat/tc8.5.x/trunk/java/org/apache/tomcat/util/net/SocketProcessorBase.java Thu Jun
23 11:33:20 2016
@@ -16,6 +16,7 @@
  */
 package org.apache.tomcat.util.net;
 
+import java.util.Objects;
 
 public abstract class SocketProcessorBase<S> implements Runnable {
 
@@ -28,13 +29,9 @@ public abstract class SocketProcessorBas
 
 
     public void reset(SocketWrapperBase<S> socketWrapper, SocketEvent event) {
+        Objects.requireNonNull(event);
         this.socketWrapper = socketWrapper;
-        if (event == null) {
-            // Should never happen
-            throw new NullPointerException();
-        } else {
-            this.event = event;
-        }
+        this.event = event;
     }
 
 

Modified: tomcat/tc8.5.x/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/Room.java
URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/Room.java?rev=1749868&r1=1749867&r2=1749868&view=diff
==============================================================================
--- tomcat/tc8.5.x/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/Room.java (original)
+++ tomcat/tc8.5.x/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/Room.java Thu
Jun 23 11:33:20 2016
@@ -25,6 +25,7 @@ import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Objects;
 import java.util.Timer;
 import java.util.TimerTask;
 import java.util.concurrent.locks.ReentrantLock;
@@ -484,8 +485,8 @@ public final class Room {
          * @param content
          */
         private void sendRoomMessage(MessageType type, String content) {
-            if (content == null || type == null)
-                throw new NullPointerException();
+            Objects.requireNonNull(content);
+            Objects.requireNonNull(type);
 
             String completeMsg = String.valueOf(type.flag) + content;
 




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


Mime
View raw message