< prev index next >

src/java.base/share/classes/sun/security/x509/CertificateExtensions.java

Print this page




 272         }
 273     }
 274 
 275     /**
 276      * Return the name of this attribute.
 277      */
 278     public String getName() {
 279         return NAME;
 280     }
 281 
 282     /**
 283      * Return true if a critical extension is found that is
 284      * not supported, otherwise return false.
 285      */
 286     public boolean hasUnsupportedCriticalExtension() {
 287         return unsupportedCritExt;
 288     }
 289 
 290     /**
 291      * Compares this CertificateExtensions for equality with the specified
 292      * object. If the <code>other</code> object is an
 293      * <code>instanceof</code> <code>CertificateExtensions</code>, then
 294      * all the entries are compared with the entries from this.
 295      *
 296      * @param other the object to test for equality with this
 297      * CertificateExtensions.
 298      * @return true iff all the entries match that of the Other,
 299      * false otherwise.
 300      */
 301     public boolean equals(Object other) {
 302         if (this == other)
 303             return true;
 304         if (!(other instanceof CertificateExtensions))
 305             return false;
 306         Collection<Extension> otherC =
 307                 ((CertificateExtensions)other).getAllExtensions();
 308         Object[] objs = otherC.toArray();
 309 
 310         int len = objs.length;
 311         if (len != map.size())
 312             return false;
 313 


 322             thisExt = map.get(key);
 323             if (thisExt == null)
 324                 return false;
 325             if (! thisExt.equals(otherExt))
 326                 return false;
 327         }
 328         return this.getUnparseableExtensions().equals(
 329                 ((CertificateExtensions)other).getUnparseableExtensions());
 330     }
 331 
 332     /**
 333      * Returns a hashcode value for this CertificateExtensions.
 334      *
 335      * @return the hashcode value.
 336      */
 337     public int hashCode() {
 338         return map.hashCode() + getUnparseableExtensions().hashCode();
 339     }
 340 
 341     /**
 342      * Returns a string representation of this <tt>CertificateExtensions</tt>
 343      * object in the form of a set of entries, enclosed in braces and separated
 344      * by the ASCII characters "<tt>,&nbsp;</tt>" (comma and space).
 345      * <p>Overrides to <tt>toString</tt> method of <tt>Object</tt>.
 346      *
 347      * @return  a string representation of this CertificateExtensions.
 348      */
 349     public String toString() {
 350         return map.toString();
 351     }
 352 
 353 }
 354 
 355 class UnparseableExtension extends Extension {
 356     private String name;
 357     private Throwable why;
 358 
 359     public UnparseableExtension(Extension ext, Throwable why) {
 360         super(ext);
 361 
 362         name = "";
 363         try {
 364             Class<?> extClass = OIDMap.getClass(ext.getExtensionId());
 365             if (extClass != null) {


 272         }
 273     }
 274 
 275     /**
 276      * Return the name of this attribute.
 277      */
 278     public String getName() {
 279         return NAME;
 280     }
 281 
 282     /**
 283      * Return true if a critical extension is found that is
 284      * not supported, otherwise return false.
 285      */
 286     public boolean hasUnsupportedCriticalExtension() {
 287         return unsupportedCritExt;
 288     }
 289 
 290     /**
 291      * Compares this CertificateExtensions for equality with the specified
 292      * object. If the {@code other} object is an
 293      * {@code instanceof} {@code CertificateExtensions}, then
 294      * all the entries are compared with the entries from this.
 295      *
 296      * @param other the object to test for equality with this
 297      * CertificateExtensions.
 298      * @return true iff all the entries match that of the Other,
 299      * false otherwise.
 300      */
 301     public boolean equals(Object other) {
 302         if (this == other)
 303             return true;
 304         if (!(other instanceof CertificateExtensions))
 305             return false;
 306         Collection<Extension> otherC =
 307                 ((CertificateExtensions)other).getAllExtensions();
 308         Object[] objs = otherC.toArray();
 309 
 310         int len = objs.length;
 311         if (len != map.size())
 312             return false;
 313 


 322             thisExt = map.get(key);
 323             if (thisExt == null)
 324                 return false;
 325             if (! thisExt.equals(otherExt))
 326                 return false;
 327         }
 328         return this.getUnparseableExtensions().equals(
 329                 ((CertificateExtensions)other).getUnparseableExtensions());
 330     }
 331 
 332     /**
 333      * Returns a hashcode value for this CertificateExtensions.
 334      *
 335      * @return the hashcode value.
 336      */
 337     public int hashCode() {
 338         return map.hashCode() + getUnparseableExtensions().hashCode();
 339     }
 340 
 341     /**
 342      * Returns a string representation of this {@code CertificateExtensions}
 343      * object in the form of a set of entries, enclosed in braces and separated
 344      * by the ASCII characters "<code>,&nbsp;</code>" (comma and space).
 345      * <p>Overrides to {@code toString} method of {@code Object}.
 346      *
 347      * @return  a string representation of this CertificateExtensions.
 348      */
 349     public String toString() {
 350         return map.toString();
 351     }
 352 
 353 }
 354 
 355 class UnparseableExtension extends Extension {
 356     private String name;
 357     private Throwable why;
 358 
 359     public UnparseableExtension(Extension ext, Throwable why) {
 360         super(ext);
 361 
 362         name = "";
 363         try {
 364             Class<?> extClass = OIDMap.getClass(ext.getExtensionId());
 365             if (extClass != null) {
< prev index next >