You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Paulex Yang (JIRA)" <ji...@apache.org> on 2007/04/12 04:37:32 UTC
[jira] Closed: (HARMONY-3552)
[classlib][security]java.security.SecureRandom.next(int bitCount) returns a
int which has a longer bit length than required.
[ https://issues.apache.org/jira/browse/HARMONY-3552?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paulex Yang closed HARMONY-3552.
--------------------------------
Verified by Leo.
> [classlib][security]java.security.SecureRandom.next(int bitCount) returns a int which has a longer bit length than required.
> ----------------------------------------------------------------------------------------------------------------------------
>
> Key: HARMONY-3552
> URL: https://issues.apache.org/jira/browse/HARMONY-3552
> Project: Harmony
> Issue Type: Bug
> Components: Classlib
> Reporter: Leo Li
> Assigned To: Paulex Yang
> Attachments: patch-3552.diff
>
>
> Here is a testcase:
> public void test_Next() throws Exception {
> MySecureRandom mySecureRandom = new MySecureRandom(
> new MySecureRandomSpi(), null);
> int numBits = 29;
> int random = mySecureRandom.getNext(numBits);
> assertEquals(numBits, Integer.bitCount(random));
> }
>
> class MySecureRandom extends SecureRandom {
> private static final long serialVersionUID = 1L;
> public MySecureRandom(SecureRandomSpi secureRandomSpi, Provider provider) {
> super(secureRandomSpi, provider);
> }
> public int getNext(int numBits) {
> return super.next(numBits);
> }
> }
> class MySecureRandomSpi extends SecureRandomSpi {
> private static final long serialVersionUID = 1L;
> @Override
> protected byte[] engineGenerateSeed(int arg0) {
> return null;
> }
> @Override
> protected void engineNextBytes(byte[] bytes) {
> for (int i = 0; i < bytes.length; i++) {
> bytes[i] = (byte) 0xFF;
> }
> }
> @Override
> protected void engineSetSeed(byte[] arg0) {
> return;
> }
> }
> RI passes.
> Harmony fails with an int with length 32.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.