equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1998, 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 |
118 * Get GeneralNameInterface |
118 * Get GeneralNameInterface |
119 */ |
119 */ |
120 private GeneralNameInterface getGNI(ObjectIdentifier oid, byte[] nameValue) |
120 private GeneralNameInterface getGNI(ObjectIdentifier oid, byte[] nameValue) |
121 throws IOException { |
121 throws IOException { |
122 try { |
122 try { |
123 Class extClass = OIDMap.getClass(oid); |
123 Class<?> extClass = OIDMap.getClass(oid); |
124 if (extClass == null) { // Unsupported OtherName |
124 if (extClass == null) { // Unsupported OtherName |
125 return null; |
125 return null; |
126 } |
126 } |
127 Class[] params = { Object.class }; |
127 Class<?>[] params = { Object.class }; |
128 Constructor cons = ((Class<?>)extClass).getConstructor(params); |
128 Constructor<?> cons = extClass.getConstructor(params); |
129 |
129 |
130 Object[] passed = new Object[] { nameValue }; |
130 Object[] passed = new Object[] { nameValue }; |
131 GeneralNameInterface gni = |
131 GeneralNameInterface gni = |
132 (GeneralNameInterface)cons.newInstance(passed); |
132 (GeneralNameInterface)cons.newInstance(passed); |
133 return gni; |
133 return gni; |
134 } catch (Exception e) { |
134 } catch (Exception e) { |
135 throw (IOException)new IOException("Instantiation error: " + e).initCause(e); |
135 throw new IOException("Instantiation error: " + e, e); |
136 } |
136 } |
137 } |
137 } |
138 |
138 |
139 /** |
139 /** |
140 * Return the type of the GeneralName. |
140 * Return the type of the GeneralName. |
174 } |
174 } |
175 if (!(other instanceof OtherName)) { |
175 if (!(other instanceof OtherName)) { |
176 return false; |
176 return false; |
177 } |
177 } |
178 OtherName otherOther = (OtherName)other; |
178 OtherName otherOther = (OtherName)other; |
179 if (!(otherOther.oid.equals(oid))) { |
179 if (!(otherOther.oid.equals((Object)oid))) { |
180 return false; |
180 return false; |
181 } |
181 } |
182 GeneralNameInterface otherGNI = null; |
182 GeneralNameInterface otherGNI = null; |
183 try { |
183 try { |
184 otherGNI = getGNI(otherOther.oid, otherOther.nameValue); |
184 otherGNI = getGNI(otherOther.oid, otherOther.nameValue); |