harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stepan Mishura (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-2761) [classlib][security] Security.getProviders throws NumberFormatException unexpectedly
Date Tue, 23 Jan 2007 04:20:49 GMT

    [ https://issues.apache.org/jira/browse/HARMONY-2761?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12466638

Stepan Mishura commented on HARMONY-2761:

Hi Leo,

Yes, this is a bug - Security.getProviders("Signature.SHA1withDSA KeySize:512") shouldn't
throw NumberFormatException.

But from my point of view there are two separate issues here:
1) the bug for valid param string - "Signature.SHA1withDSA KeySize:512"
2) inconsistency with RI for invalid string - "Signature.SHA1withDSA KeySize"

The bug should be fixed and the question is how we should resolve inconsistency with RI. So
the spec says for:
"public static Provider[] getProviders(String filter)
<crypto_service>.<algorithm_or_type> <attribute_name>:< attribute_value>

The cryptographic service name must not contain any dots. There must be one or more space
charaters between the the <algorithm_or_type> and the <attribute_name>. "

As I understand the spec. < attribute_value>  can not be an empty string. So the string
"Signature.SHA1withDSA KeySize" is invalid and InvalidParameterException should be thrown.
So Harmony implementation follows the spec. However RI accepts the string and returns a provider

Also I've pick up one of tests that you modified:
@@ -140,11 +134,7 @@
         m.put("AAA.BBB CCC", "");
         m.put("AAA.BBB", "");
-        try {
-            Security.getProviders(m);
-            fail("attribute value is empty string: No expected InvalidParameterException");
-        } catch (InvalidParameterException  e) {    
-        }
+        assertNull(Security.getProviders(m));        

The test follows the spec. It adds key with empty value to the map and verifies that InvalidParameterException
is thrown.
The spec. says for :
"public static Provider[] getProviders(Map<String,String> filter)
The value associated with the key must be a non-empty string"

So if this test fails after applying the patch that means we'll have inconsistency with the
spec here too.

I think Harmony follows the spec. and RI doesn't. Please correct me if I'm wrong. Thoughts?


> [classlib][security] Security.getProviders throws NumberFormatException unexpectedly
> ------------------------------------------------------------------------------------
>                 Key: HARMONY-2761
>                 URL: https://issues.apache.org/jira/browse/HARMONY-2761
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Leo Li
>         Assigned To: Stepan Mishura
>         Attachments: patch-2761.diff
> Here is a testcase:
> public void testgetProviders()
> {
>     Provider[] providers = Security.getProviders("Signature.SHA1withDSA KeySize:512");
> }
> RI passes.
> Harmony fails with throwing NumberFormatException.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message