Code example for InvalidObjectException

        return new SerializationProxyV1(token, expires, permissions, source, lastRefresh);
    // have a readObject that throws to prevent spoofing 
    private void readObject(ObjectInputStream stream) throws InvalidObjectException {
        throw new InvalidObjectException("Cannot readObject, serialization proxy required");
    private static Date getBundleLongAsDate(Bundle bundle, String key, Date dateBase) {
        if (bundle == null) {
            return null; 
        long secondsFromBase = Long.MIN_VALUE;
        Object secondsObject = bundle.get(key);
        if (secondsObject instanceof Long) {
            secondsFromBase = (Long) secondsObject;
        } else if (secondsObject instanceof String) {
Connect your IDE to all the code out there  Get Codota for Java