Author: markt
Date: Wed Oct  8 19:01:20 2014
New Revision: 1630199

URL: http://svn.apache.org/r1630199
Log:
NPE protection. Note NPE only possible with test code.

Modified:
    tomcat/trunk/java/org/apache/tomcat/websocket/Util.java

Modified: tomcat/trunk/java/org/apache/tomcat/websocket/Util.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/Util.java?rev=1630199&r1=1630198&r2=1630199&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/websocket/Util.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/Util.java Wed Oct  8 19:01:20 
2014
@@ -332,21 +332,23 @@ public class Util {
                     throws DeploymentException{
 
         List<DecoderEntry> result = new ArrayList<>();
-        for (Class<? extends Decoder> decoderClazz : decoderClazzes) {
-            // Need to instantiate decoder to ensure it is valid and that
-            // deployment can be failed if it is not
-            @SuppressWarnings("unused")
-            Decoder instance;
-            try {
-                instance = decoderClazz.newInstance();
-            } catch (InstantiationException | IllegalAccessException e) {
-                throw new DeploymentException(
-                        sm.getString("pojoMethodMapping.invalidDecoder",
-                                decoderClazz.getName()), e);
+        if (decoderClazzes != null) {
+            for (Class<? extends Decoder> decoderClazz : decoderClazzes) {
+                // Need to instantiate decoder to ensure it is valid and that
+                // deployment can be failed if it is not
+                @SuppressWarnings("unused")
+                Decoder instance;
+                try {
+                    instance = decoderClazz.newInstance();
+                } catch (InstantiationException | IllegalAccessException e) {
+                    throw new DeploymentException(
+                            sm.getString("pojoMethodMapping.invalidDecoder",
+                                    decoderClazz.getName()), e);
+                }
+                DecoderEntry entry = new DecoderEntry(
+                        Util.getDecoderType(decoderClazz), decoderClazz);
+                result.add(entry);
             }
-            DecoderEntry entry = new DecoderEntry(
-                    Util.getDecoderType(decoderClazz), decoderClazz);
-            result.add(entry);
         }
 
         return result;



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

Reply via email to