jdk/src/share/classes/sun/security/x509/CertificateExtensions.java
changeset 10336 0bb1999251f8
parent 5506 202f599c92aa
child 13040 1f31b09f711d
--- a/jdk/src/share/classes/sun/security/x509/CertificateExtensions.java	Mon Aug 15 12:56:01 2011 -0700
+++ b/jdk/src/share/classes/sun/security/x509/CertificateExtensions.java	Mon Aug 15 11:48:20 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -93,7 +93,7 @@
     // Parse the encoded extension
     private void parseExtension(Extension ext) throws IOException {
         try {
-            Class extClass = OIDMap.getClass(ext.getExtensionId());
+            Class<?> extClass = OIDMap.getClass(ext.getExtensionId());
             if (extClass == null) {   // Unsupported extension
                 if (ext.isCritical()) {
                     unsupportedCritExt = true;
@@ -104,11 +104,12 @@
                     throw new IOException("Duplicate extensions not allowed");
                 }
             }
-            Constructor cons = ((Class<?>)extClass).getConstructor(PARAMS);
+            Constructor<?> cons = extClass.getConstructor(PARAMS);
 
             Object[] passed = new Object[] {Boolean.valueOf(ext.isCritical()),
                     ext.getExtensionValue()};
-                    CertAttrSet certExt = (CertAttrSet)cons.newInstance(passed);
+                    CertAttrSet<?> certExt = (CertAttrSet<?>)
+                            cons.newInstance(passed);
                     if (map.put(certExt.getName(), (Extension)certExt) != null) {
                         throw new IOException("Duplicate extensions not allowed");
                     }
@@ -132,12 +133,12 @@
             if (e instanceof IOException) {
                 throw (IOException)e;
             } else {
-                throw (IOException)new IOException(e.toString()).initCause(e);
+                throw new IOException(e);
             }
         } catch (IOException e) {
             throw e;
         } catch (Exception e) {
-            throw (IOException)new IOException(e.toString()).initCause(e);
+            throw new IOException(e);
         }
     }
 
@@ -210,8 +211,8 @@
      * @param name the extension name used in the lookup.
      * @exception IOException if named extension is not found.
      */
-    public Object get(String name) throws IOException {
-        Object obj = map.get(name);
+    public Extension get(String name) throws IOException {
+        Extension obj = map.get(name);
         if (obj == null) {
             throw new IOException("No extension found with name " + name);
         }
@@ -233,7 +234,7 @@
 
     public String getNameByOid(ObjectIdentifier oid) throws IOException {
         for (String name: map.keySet()) {
-            if (map.get(name).getExtensionId().equals(oid)) {
+            if (map.get(name).getExtensionId().equals((Object)oid)) {
                 return name;
             }
         }
@@ -353,7 +354,7 @@
 
         name = "";
         try {
-            Class extClass = OIDMap.getClass(ext.getExtensionId());
+            Class<?> extClass = OIDMap.getClass(ext.getExtensionId());
             if (extClass != null) {
                 Field field = extClass.getDeclaredField("NAME");
                 name = (String)(field.get(null)) + " ";