< prev index next >
src/share/classes/javax/crypto/spec/PBEKeySpec.java
Print this page
rev 1387 : 7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
Reviewed-by: xuelei, mullan
Contributed-by: alexandre.boulgakov@oracle.com
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -78,11 +78,11 @@
*/
public PBEKeySpec(char[] password) {
if ((password == null) || (password.length == 0)) {
this.password = new char[0];
} else {
- this.password = (char[])password.clone();
+ this.password = password.clone();
}
}
/**
@@ -107,20 +107,20 @@
public PBEKeySpec(char[] password, byte[] salt, int iterationCount,
int keyLength) {
if ((password == null) || (password.length == 0)) {
this.password = new char[0];
} else {
- this.password = (char[])password.clone();
+ this.password = password.clone();
}
if (salt == null) {
throw new NullPointerException("the salt parameter " +
"must be non-null");
} else if (salt.length == 0) {
throw new IllegalArgumentException("the salt parameter " +
"must not be empty");
} else {
- this.salt = (byte[]) salt.clone();
+ this.salt = salt.clone();
}
if (iterationCount<=0) {
throw new IllegalArgumentException("invalid iterationCount value");
}
if (keyLength<=0) {
@@ -149,20 +149,20 @@
*/
public PBEKeySpec(char[] password, byte[] salt, int iterationCount) {
if ((password == null) || (password.length == 0)) {
this.password = new char[0];
} else {
- this.password = (char[])password.clone();
+ this.password = password.clone();
}
if (salt == null) {
throw new NullPointerException("the salt parameter " +
"must be non-null");
} else if (salt.length == 0) {
throw new IllegalArgumentException("the salt parameter " +
"must not be empty");
} else {
- this.salt = (byte[]) salt.clone();
+ this.salt = salt.clone();
}
if (iterationCount<=0) {
throw new IllegalArgumentException("invalid iterationCount value");
}
this.iterationCount = iterationCount;
@@ -194,11 +194,11 @@
*/
public final char[] getPassword() {
if (password == null) {
throw new IllegalStateException("password has been cleared");
}
- return (char[]) password.clone();
+ return password.clone();
}
/**
* Returns a copy of the salt or null if not specified.
*
@@ -208,11 +208,11 @@
*
* @return the salt.
*/
public final byte[] getSalt() {
if (salt != null) {
- return (byte[]) salt.clone();
+ return salt.clone();
} else {
return null;
}
}
< prev index next >