--- a/jdk/src/share/classes/com/sun/crypto/provider/PBEParameters.java Mon Aug 15 12:56:01 2011 -0700
+++ b/jdk/src/share/classes/com/sun/crypto/provider/PBEParameters.java Mon Aug 15 11:48:20 2011 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,6 @@
package com.sun.crypto.provider;
-import java.util.*;
import java.io.*;
import java.math.BigInteger;
import java.security.AlgorithmParametersSpi;
@@ -65,7 +64,7 @@
throw new InvalidParameterSpecException
("Inappropriate parameter specification");
}
- this.salt = (byte[])((PBEParameterSpec)paramSpec).getSalt().clone();
+ this.salt = ((PBEParameterSpec)paramSpec).getSalt().clone();
this.iCount = ((PBEParameterSpec)paramSpec).getIterationCount();
}
@@ -98,11 +97,12 @@
engineInit(encoded);
}
- protected AlgorithmParameterSpec engineGetParameterSpec(Class paramSpec)
+ protected <T extends AlgorithmParameterSpec>
+ T engineGetParameterSpec(Class<T> paramSpec)
throws InvalidParameterSpecException
{
if (PBEParameterSpec.class.isAssignableFrom(paramSpec)) {
- return new PBEParameterSpec(this.salt, this.iCount);
+ return paramSpec.cast(new PBEParameterSpec(this.salt, this.iCount));
} else {
throw new InvalidParameterSpecException
("Inappropriate parameter specification");