code: private void readObject(ObjectInputStream stream)
                           throws IOException, ClassNotFoundException {
          stream.defaultReadObject();
  
          try {
              compiledPattern = compile(pattern);
          } catch (Exception e) {
              throw new InvalidObjectException("invalid pattern");
          }
  
          if (serialVersionOnStream < 1) {
              // didn't have defaultCenturyStart field
              initializeDefaultCentury();
          }
          else {
              // fill in dependent transient field
              parseAmbiguousDatesAsAfter(defaultCenturyStart);
          }
          serialVersionOnStream = currentSerialVersion;
  
          // If the deserialized object has a SimpleTimeZone, try
          // to replace it with a ZoneInfo equivalent in order to
          // be compatible with the SimpleTimeZone-based
          // implementation as much as possible.
          TimeZone tz = getTimeZone();
          if (tz instanceof SimpleTimeZone) {
              String id = tz.getID();
              TimeZone zi = TimeZone.getTimeZone(id);
              if (zi != null && zi.hasSameRules(tz) && zi.getID().equals(id)) {
                  setTimeZone(zi);
              }
          }
      }
docs: After reading an object from the input stream, the format
  pattern in the object is verified.
  <p>
  @exception InvalidObjectException if the pattern is invalid