jdk/src/share/classes/sun/security/x509/AlgorithmId.java
changeset 10336 0bb1999251f8
parent 6122 16fa7ed7ff1b
child 12685 8a448b5b9006
equal deleted inserted replaced
10335:3c7eda3ab2f5 10336:0bb1999251f8
     1 /*
     1 /*
     2  * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
   234     public String getName() {
   234     public String getName() {
   235         String algName = nameTable.get(algid);
   235         String algName = nameTable.get(algid);
   236         if (algName != null) {
   236         if (algName != null) {
   237             return algName;
   237             return algName;
   238         }
   238         }
   239         if ((params != null) && algid.equals(specifiedWithECDSA_oid)) {
   239         if ((params != null) && algid.equals((Object)specifiedWithECDSA_oid)) {
   240             try {
   240             try {
   241                 AlgorithmId paramsId =
   241                 AlgorithmId paramsId =
   242                         AlgorithmId.parse(new DerValue(getEncodedParams()));
   242                         AlgorithmId.parse(new DerValue(getEncodedParams()));
   243                 String paramsName = paramsId.getName();
   243                 String paramsName = paramsId.getName();
   244                 if (paramsName.equals("SHA")) {
   244                 if (paramsName.equals("SHA")) {
   271      * with the same parameters.
   271      * with the same parameters.
   272      */
   272      */
   273     public boolean equals(AlgorithmId other) {
   273     public boolean equals(AlgorithmId other) {
   274         boolean paramsEqual =
   274         boolean paramsEqual =
   275           (params == null ? other.params == null : params.equals(other.params));
   275           (params == null ? other.params == null : params.equals(other.params));
   276         return (algid.equals(other.algid) && paramsEqual);
   276         return (algid.equals((Object)other.algid) && paramsEqual);
   277     }
   277     }
   278 
   278 
   279     /**
   279     /**
   280      * Compares this AlgorithmID to another.  If algorithm parameters are
   280      * Compares this AlgorithmID to another.  If algorithm parameters are
   281      * available, they are compared.  Otherwise, just the object IDs
   281      * available, they are compared.  Otherwise, just the object IDs
   299     /**
   299     /**
   300      * Compares two algorithm IDs for equality.  Returns true iff
   300      * Compares two algorithm IDs for equality.  Returns true iff
   301      * they are the same algorithm, ignoring algorithm parameters.
   301      * they are the same algorithm, ignoring algorithm parameters.
   302      */
   302      */
   303     public final boolean equals(ObjectIdentifier id) {
   303     public final boolean equals(ObjectIdentifier id) {
   304         return algid.equals(id);
   304         return algid.equals((Object)id);
   305     }
   305     }
   306 
   306 
   307     /**
   307     /**
   308      * Returns a hashcode for this AlgorithmId.
   308      * Returns a hashcode for this AlgorithmId.
   309      *
   309      *