Index: modules/security/src/test/java/common/java/security/cert/X509CRLSelectorTest.java =================================================================== --- modules/security/src/test/java/common/java/security/cert/X509CRLSelectorTest.java (revision 406627) +++ modules/security/src/test/java/common/java/security/cert/X509CRLSelectorTest.java (working copy) @@ -277,6 +277,19 @@ } /** + * @tests java.security.cert.X509CRLSelector#addIssuer(javax.security.auth.x500.X500Principal) + */ + public void test_addIssuerLjavax_security_auth_x500_X500Principal() throws Exception { + X509CRLSelector obj = new X509CRLSelector(); + try { + obj.addIssuer((X500Principal) null); + fail("NullPointerException expected"); + } catch (NullPointerException e) { + // expected + } + } + + /** * addIssuerName(String name) method testing. * Tests if CRLs with specified issuers match the selector, * and if not specified issuer does not match the selector. @@ -347,6 +360,45 @@ } /** + * @tests java.security.cert.X509CRLSelector#addIssuerName(java.lang.String) + */ + public void test_addIssuerNameLjava_lang_String() throws Exception { + X509CRLSelector obj = new X509CRLSelector(); + try { + obj.addIssuerName("234"); + fail("IOException expected"); + } catch (IOException e) { + // expected + } + } + + /** + * @tests java.security.cert.X509CRLSelector#addIssuerName(byte[]) + */ + public void test_addIssuerName$B_3() throws Exception { + X509CRLSelector obj = new X509CRLSelector(); + try { + obj.addIssuerName(new byte[]{(byte)2,(byte)3,(byte)4}); + fail("IOException expected"); + } catch (IOException e) { + // expected + } + } + + /** + * @tests java.security.cert.X509CRLSelector#addIssuerName(byte[]) + */ + public void test_addIssuerName$B_4() throws Exception { + X509CRLSelector obj = new X509CRLSelector(); + try { + obj.addIssuerName((byte[]) null); + fail("NullPointerException expected"); + } catch (NullPointerException e) { + // expected + } + } + + /** * setMinCRLNumber(BigInteger minCRL) method testing. * Tests if CRLs with any crl number value match the selector in the case of * null crlNumber criteria, if specified minCRL value matches the selector, Index: modules/security/src/test/java/common/java/security/cert/X509CertSelectorTest.java =================================================================== --- modules/security/src/test/java/common/java/security/cert/X509CertSelectorTest.java (revision 406627) +++ modules/security/src/test/java/common/java/security/cert/X509CertSelectorTest.java (working copy) @@ -1179,6 +1179,19 @@ } /** + * @tests java.security.cert.X509CertSelector#setSubjectPublicKeyAlgID(java.lang.String) + */ + public void test_setSubjectPublicKeyAlgIDLjava_lang_String() throws Exception { + X509CertSelector obj = new X509CertSelector(); + try { + obj.setSubjectPublicKeyAlgID("abc"); + fail("IOException expected"); + } catch (IOException e) { + // expected + } + } + + /** * getSubjectPublicKeyAlgID() method testing. * Tests if the method return null in the case of not specified criteria, * if the returned value [does not]corresponds to [not]specified Index: modules/security/src/main/java/common/java/security/cert/X509CRLSelector.java =================================================================== --- modules/security/src/main/java/common/java/security/cert/X509CRLSelector.java (revision 406627) +++ modules/security/src/main/java/common/java/security/cert/X509CRLSelector.java (working copy) @@ -95,6 +95,9 @@ * @com.intel.drl.spec_ref */ public void addIssuer(X500Principal issuer) { + if (issuer == null) { + throw new NullPointerException("issuer"); + } if (issuerNames == null) { issuerNames = new ArrayList(); } @@ -110,17 +113,28 @@ if (issuerNames == null) { issuerNames = new ArrayList(); } - addIssuer(new X500Principal(name)); + try { + addIssuer(new X500Principal(name)); + } catch (Exception e) { + throw (IOException) new IOException(e.getMessage()).initCause(e); + } } /** * @com.intel.drl.spec_ref */ public void addIssuerName(byte[] name) throws IOException { + if (name == null) { + throw new NullPointerException("name"); + } if (issuerNames == null) { issuerNames = new ArrayList(); } - addIssuer(new X500Principal(name)); + try { + addIssuer(new X500Principal(name)); + } catch (Exception e) { + throw (IOException) new IOException(e.getMessage()).initCause(e); + } } /** Index: modules/security/src/main/java/common/java/security/cert/X509CertSelector.java =================================================================== --- modules/security/src/main/java/common/java/security/cert/X509CertSelector.java (revision 406627) +++ modules/security/src/main/java/common/java/security/cert/X509CertSelector.java (working copy) @@ -360,6 +360,8 @@ if ((comp < 0) || (comp > 39)) { throw new IOException("The OID: \"" + oid + "\" is icorrect."); } + } catch (IndexOutOfBoundsException e) { + throw new IOException("The OID: \"" + oid + "\" is icorrect."); } catch (NumberFormatException e) { throw new IOException("The OID: \"" + oid + "\" is icorrect."); }