View Javadoc
1   package com.github.sevntu.checkstyle.checks.coding;
2   import java.io.IOException;
3   import java.io.ObjectInputStream;
4   import java.io.Serializable;
5   import java.text.ParseException;
6   import java.text.SimpleDateFormat;
7   import java.util.Date;
8   public class InputAvoidDefaultSerializableInInnerClasses2
9   {
10      public class Foo implements Serializable {
11  
12          public Date date;
13  
14  //      real readObject is commented
15  //      private void readObject(ObjectInputStream aInputStream)
16  //              throws ClassNotFoundException, IOException {
17  //          // always perform the default de-serialization first
18  //          aInputStream.defaultReadObject();
19  //          date = (Date) aInputStream.readObject();
20  //      }
21          //there should be warning, though method is both private and named readObject
22          private Foo readObject(String str)  throws  ParseException {
23              Foo result = new Foo();
24              result.date = new SimpleDateFormat().parse(str);
25              return result;
26          }
27      }
28  }