jdk/src/share/classes/javax/xml/crypto/dsig/TransformService.java
changeset 11276 6a7de6dddc18
parent 5506 202f599c92aa
child 14342 8435a30053c1
equal deleted inserted replaced
11275:7cb0861d512f 11276:6a7de6dddc18
   155         }
   155         }
   156         boolean dom = false;
   156         boolean dom = false;
   157         if (mechanismType.equals("DOM")) {
   157         if (mechanismType.equals("DOM")) {
   158             dom = true;
   158             dom = true;
   159         }
   159         }
   160         List services = GetInstance.getServices("TransformService", algorithm);
   160         List<Service> services = GetInstance.getServices("TransformService", algorithm);
   161         for (Iterator t = services.iterator(); t.hasNext(); ) {
   161         for (Iterator<Service> t = services.iterator(); t.hasNext(); ) {
   162             Service s = (Service)t.next();
   162             Service s = t.next();
   163             String value = s.getAttribute("MechanismType");
   163             String value = s.getAttribute("MechanismType");
   164             if ((value == null && dom) ||
   164             if ((value == null && dom) ||
   165                 (value != null && value.equals(mechanismType))) {
   165                 (value != null && value.equals(mechanismType))) {
   166                 Instance instance = GetInstance.getInstance(s, null);
   166                 Instance instance = GetInstance.getInstance(s, null);
   167                 TransformService ts = (TransformService) instance.impl;
   167                 TransformService ts = (TransformService) instance.impl;
   275         throw new NoSuchAlgorithmException
   275         throw new NoSuchAlgorithmException
   276             (algorithm + " algorithm and " + mechanismType
   276             (algorithm + " algorithm and " + mechanismType
   277                  + " mechanism not available");
   277                  + " mechanism not available");
   278     }
   278     }
   279 
   279 
   280     private static class MechanismMapEntry implements Map.Entry {
   280     private static class MechanismMapEntry implements Map.Entry<String,String> {
   281         private final String mechanism;
   281         private final String mechanism;
   282         private final String algorithm;
   282         private final String algorithm;
   283         private final String key;
   283         private final String key;
   284         MechanismMapEntry(String algorithm, String mechanism) {
   284         MechanismMapEntry(String algorithm, String mechanism) {
   285             this.algorithm = algorithm;
   285             this.algorithm = algorithm;
   288         }
   288         }
   289         public boolean equals(Object o) {
   289         public boolean equals(Object o) {
   290             if (!(o instanceof Map.Entry)) {
   290             if (!(o instanceof Map.Entry)) {
   291                 return false;
   291                 return false;
   292             }
   292             }
   293             Map.Entry e = (Map.Entry) o;
   293             Map.Entry<?,?> e = (Map.Entry<?,?>) o;
   294             return (getKey()==null ?
   294             return (getKey()==null ?
   295                     e.getKey()==null : getKey().equals(e.getKey())) &&
   295                     e.getKey()==null : getKey().equals(e.getKey())) &&
   296                    (getValue()==null ?
   296                    (getValue()==null ?
   297                     e.getValue()==null : getValue().equals(e.getValue()));
   297                     e.getValue()==null : getValue().equals(e.getValue()));
   298         }
   298         }
   299         public Object getKey() {
   299         public String getKey() {
   300             return key;
   300             return key;
   301         }
   301         }
   302         public Object getValue() {
   302         public String getValue() {
   303             return mechanism;
   303             return mechanism;
   304         }
   304         }
   305         public Object setValue(Object value) {
   305         public String setValue(String value) {
   306             throw new UnsupportedOperationException();
   306             throw new UnsupportedOperationException();
   307         }
   307         }
   308         public int hashCode() {
   308         public int hashCode() {
   309             return (getKey()==null ? 0 : getKey().hashCode()) ^
   309             return (getKey()==null ? 0 : getKey().hashCode()) ^
   310                    (getValue()==null ? 0 : getValue().hashCode());
   310                    (getValue()==null ? 0 : getValue().hashCode());