Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 20977 invoked from network); 31 Dec 2006 09:21:42 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 31 Dec 2006 09:21:42 -0000 Received: (qmail 20710 invoked by uid 500); 31 Dec 2006 09:21:49 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 20689 invoked by uid 500); 31 Dec 2006 09:21:48 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 20680 invoked by uid 99); 31 Dec 2006 09:21:48 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 31 Dec 2006 01:21:48 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 31 Dec 2006 01:21:41 -0800 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 14D217141BE for ; Sun, 31 Dec 2006 01:21:21 -0800 (PST) Message-ID: <25583253.1167556881082.JavaMail.jira@brutus> Date: Sun, 31 Dec 2006 01:21:21 -0800 (PST) From: "Ruth Cao (JIRA)" To: commits@harmony.apache.org Subject: [jira] Created: (HARMONY-2931) [classlib][security] KeyStoreSpi.engineLoad(KeyStore.LoadStoreParameter) catches exception improperly MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [classlib][security] KeyStoreSpi.engineLoad(KeyStore.LoadStoreParameter) catches exception improperly ----------------------------------------------------------------------------------------------------- Key: HARMONY-2931 URL: http://issues.apache.org/jira/browse/HARMONY-2931 Project: Harmony Issue Type: Bug Components: Classlib Reporter: Ruth Cao Attachments: Harmony-2931.diff I mocked a simple KeyStoreSpi and KeyStore.LoadStoreParameter as following: class MyKeyStoreSpi extends KeyStoreSpi { public Key engineGetKey(String alias, char[] password) throws NoSuchAlgorithmException, UnrecoverableKeyException { return null; } public Certificate[] engineGetCertificateChain(String alias) { return null; } public Certificate engineGetCertificate(String alias) { return null; } public Date engineGetCreationDate(String alias) { return new Date(0); } public void engineSetKeyEntry(String alias, Key key, char[] password, Certificate[] chain) throws KeyStoreException { throw new KeyStoreException( "engineSetKeyEntry is not supported in myKeyStoreSpi"); } public void engineSetKeyEntry(String alias, byte[] key, Certificate[] chain) throws KeyStoreException { throw new KeyStoreException( "engineSetKeyEntry is not supported in myKeyStoreSpi"); } public void engineSetCertificateEntry(String alias, Certificate cert) throws KeyStoreException { throw new KeyStoreException( "engineSetCertificateEntry is not supported in myKeyStoreSpi"); } public void engineDeleteEntry(String alias) throws KeyStoreException { throw new KeyStoreException( "engineDeleteEntry is not supported in myKeyStoreSpi"); } public Enumeration engineAliases() { return null; } public boolean engineContainsAlias(String alias) { return false; } public int engineSize() { return 0; } public boolean engineIsKeyEntry(String alias) { return false; } public boolean engineIsCertificateEntry(String alias) { return false; } public String engineGetCertificateAlias(Certificate cert) { return ""; } public void engineStore(OutputStream stream, char[] password) throws IOException, NoSuchAlgorithmException, CertificateException { if (!(stream instanceof ByteArrayOutputStream)) { throw new IOException("Incorrect stream"); } if (((ByteArrayOutputStream) stream).size() == 0) { throw new IOException("Incorrect stream size "); } } public void engineLoad(InputStream stream, char[] password) throws IOException, NoSuchAlgorithmException, CertificateException { throw new IOException(); } } class MyLoadStoreParams implements KeyStore.LoadStoreParameter { KeyStore.ProtectionParameter protPar; public MyLoadStoreParams() { } public MyLoadStoreParams(KeyStore.ProtectionParameter p) { if (p == null) { throw new NullPointerException("null parameter"); } this.protPar = p; } public KeyStore.ProtectionParameter getProtectionParameter() { return protPar; } } Run the test below: public class KeyStoreSpiTest { public static void main(String[] args) throws Exception { KeyStore.LoadStoreParameter lParam = new MyLoadStoreParams(new KeyStore.PasswordProtection(new char[0])); KeyStoreSpi spi = new MyKeyStoreSpi(); spi.engineLoad(lParam); } } Harmony throws IllegalArgumentException which does not follow spec. IMO, it should simply throws IOException to indicate there is an I/O problem. Finally , thanks for reading so far :-) -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira