2017-11-24 20:44 GMT+03:00 <ma...@apache.org>: > Author: markt > Date: Fri Nov 24 17:44:17 2017 > New Revision: 1816247 > > URL: http://svn.apache.org/viewvc?rev=1816247&view=rev > Log: > Fix a handful of low severity SpotBugs reports > - Serialization warnings. Probably ignorable but the fix is simple. > > Modified: > tomcat/trunk/java/org/apache/catalina/servlets/DefaultServlet.java > tomcat/trunk/java/org/apache/catalina/servlets/WebdavServlet.java > > Modified: tomcat/trunk/java/org/apache/catalina/servlets/DefaultServlet.java > URL: > http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/servlets/DefaultServlet.java?rev=1816247&r1=1816246&r2=1816247&view=diff > ============================================================================== > --- tomcat/trunk/java/org/apache/catalina/servlets/DefaultServlet.java > (original) > +++ tomcat/trunk/java/org/apache/catalina/servlets/DefaultServlet.java Fri > Nov 24 17:44:17 2017 > @@ -233,7 +233,7 @@ public class DefaultServlet extends Http > * the platform default is used. > */ > protected String fileEncoding = null; > - private Charset fileEncodingCharset = null; > + private transient Charset fileEncodingCharset = null;
Wrong. This does not fix the issue. Deserialization does not restore this field, it not it is initialized lazily - it is initialized in init(). To complete the fix you have to implement a "private void readObject(java.io.ObjectInputStream in)" method that calculates this field in the same way as init() does, or calculate this field lazily on first use. (Though I do not know of a use case that involves serializing and deserializing a Servlet. I guess that deserialization won't be followed by an init() call.) See https://docs.oracle.com/javase/7/docs/api/java/io/Serializable.html > /** > * If a file has a BOM, should that be used in preference to > fileEncoding? > The second half of this commit (WebdavServlet) is OK. Best regards, Konstantin Kolinko --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org