Author: markt
Date: Fri Dec 20 20:21:56 2013
New Revision: 1552805

URL: http://svn.apache.org/r1552805
Log:
Avoid possible NPE when no charset is specified

Modified:
    tomcat/tc7.0.x/trunk/   (props changed)
    tomcat/tc7.0.x/trunk/java/org/apache/coyote/Response.java
    tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml

Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
  Merged /tomcat/trunk:r1552804

Modified: tomcat/tc7.0.x/trunk/java/org/apache/coyote/Response.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/coyote/Response.java?rev=1552805&r1=1552804&r2=1552805&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/coyote/Response.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/coyote/Response.java Fri Dec 20 
20:21:56 2013
@@ -461,11 +461,14 @@ public final class Response {
 
         this.contentType = m.toStringNoCharset();
 
-        String charsetValue = m.getCharset().trim();
+        String charsetValue = m.getCharset();
 
-        if (charsetValue != null && charsetValue.length() > 0) {
-            charsetSet = true;
-            this.characterEncoding = charsetValue;
+        if (charsetValue != null) {
+            charsetValue = charsetValue.trim();
+            if (charsetValue.length() > 0) {
+                charsetSet = true;
+                this.characterEncoding = charsetValue;
+            }
         }
     }
 

Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1552805&r1=1552804&r2=1552805&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Fri Dec 20 20:21:56 2013
@@ -55,6 +55,14 @@
   They eventually become mixed with the numbered issues. (I.e., numbered
   issues to not "pop up" wrt. others).
 -->
+<section name="Tomcat 7.0.51 (violetagg)">
+  <subsection name="Coyote">
+    <fix>
+      Avoid possible NPE if a content type is specified without a character 
set.
+      (markt)
+    </fix>
+  </subsection>
+</section>
 <section name="Tomcat 7.0.50 (violetagg)">
   <subsection name="Catalina">
     <changelog>



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

Reply via email to