src/java.base/share/classes/java/security/Timestamp.java

Print this page
rev 10521 : 8055723[core]: Replace concat String to append in StringBuilder parameters
Contributed-by: Otavio Santana <otaviojava@java.net>


 126             return false;
 127         }
 128         Timestamp that = (Timestamp)obj;
 129 
 130         if (this == that) {
 131             return true;
 132         }
 133         return (timestamp.equals(that.getTimestamp()) &&
 134             signerCertPath.equals(that.getSignerCertPath()));
 135     }
 136 
 137     /**
 138      * Returns a string describing this timestamp.
 139      *
 140      * @return A string comprising the date and time of the timestamp and
 141      *         its signer's certificate.
 142      */
 143     public String toString() {
 144         StringBuilder sb = new StringBuilder();
 145         sb.append("(");
 146         sb.append("timestamp: " + timestamp);
 147         List<? extends Certificate> certs = signerCertPath.getCertificates();
 148         if (!certs.isEmpty()) {
 149             sb.append("TSA: " + certs.get(0));
 150         } else {
 151             sb.append("TSA: <empty>");
 152         }
 153         sb.append(")");
 154         return sb.toString();
 155     }
 156 
 157     // Explicitly reset hash code value to -1
 158     private void readObject(ObjectInputStream ois)
 159         throws IOException, ClassNotFoundException {
 160         ois.defaultReadObject();
 161         myhash = -1;
 162         timestamp = new Date(timestamp.getTime());
 163     }
 164 }


 126             return false;
 127         }
 128         Timestamp that = (Timestamp)obj;
 129 
 130         if (this == that) {
 131             return true;
 132         }
 133         return (timestamp.equals(that.getTimestamp()) &&
 134             signerCertPath.equals(that.getSignerCertPath()));
 135     }
 136 
 137     /**
 138      * Returns a string describing this timestamp.
 139      *
 140      * @return A string comprising the date and time of the timestamp and
 141      *         its signer's certificate.
 142      */
 143     public String toString() {
 144         StringBuilder sb = new StringBuilder();
 145         sb.append("(");
 146         sb.append("timestamp: ").append(timestamp);
 147         List<? extends Certificate> certs = signerCertPath.getCertificates();
 148         if (!certs.isEmpty()) {
 149             sb.append("TSA: ").append(certs.get(0));
 150         } else {
 151             sb.append("TSA: <empty>");
 152         }
 153         sb.append(")");
 154         return sb.toString();
 155     }
 156 
 157     // Explicitly reset hash code value to -1
 158     private void readObject(ObjectInputStream ois)
 159         throws IOException, ClassNotFoundException {
 160         ois.defaultReadObject();
 161         myhash = -1;
 162         timestamp = new Date(timestamp.getTime());
 163     }
 164 }