tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 54781] NPE in WsServerContainer if there is no matching path
Date Mon, 01 Apr 2013 19:34:23 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=54781

rstoyanchev@yahoo.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #30129|0                           |1
        is obsolete|                            |

--- Comment #1 from rstoyanchev@yahoo.com ---
Comment on attachment 30129
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=30129
A proposed fix

>Index: java/org/apache/tomcat/websocket/server/WsServerContainer.java
>===================================================================
>--- java/org/apache/tomcat/websocket/server/WsServerContainer.java	(revision 1463173)
>+++ java/org/apache/tomcat/websocket/server/WsServerContainer.java	(working copy)
>@@ -232,6 +232,11 @@
>         SortedSet<TemplatePathMatch> templateMatches =
>                 configTemplateMatchMap.get(key);
> 
>+        if (templateMatches == null) {
>+            // No match
>+        	return null;
>+        }
>+
>         // List is in alphabetical order of normalised templates.
>         // Correct match is the first one that matches.
>         Map<String,String> pathParams = null;
>Index: java/org/apache/tomcat/websocket/server/WsFilter.java
>===================================================================
>--- java/org/apache/tomcat/websocket/server/WsFilter.java	(revision 1463173)
>+++ java/org/apache/tomcat/websocket/server/WsFilter.java	(working copy)
>@@ -120,7 +120,12 @@
>         } else {
>             path = req.getServletPath() + pathInfo;
>         }
>+
>         WsMappingResult mappingResult = sc.findMapping(path);
>+        if (mappingResult == null) {
>+            chain.doFilter(request, response);
>+            return;
>+        }
> 
>         ServerEndpointConfig sec = mappingResult.getConfig();
> 
>Index: build.xml
>===================================================================
>--- build.xml	(revision 1463173)
>+++ build.xml	(working copy)
>@@ -1000,8 +1000,9 @@
>              includeantruntime="false">
>     </javac>
> 
>-    <!-- Add sources for examples -->
>+    <!-- Add sources for examples
>     <antcall target="examples-sources" />
>+     -->
> 
>     <copy file="${tomcat-dbcp.jar}" todir="${tomcat.build}/lib"
>       failonerror="false"/>

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message