8285263: Minor cleanup could be done in java.security

Reviewed-by: weijun
This commit is contained in:
Mark Powers 2022-06-13 15:13:56 +00:00 committed by Weijun Wang
parent b97a4f6cdc
commit 17695962ac
94 changed files with 480 additions and 601 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2022, 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
@ -75,13 +75,13 @@ import java.util.Objects;
public class AlgorithmParameters {
// The provider
private Provider provider;
private final Provider provider;
// The provider implementation (delegate)
private AlgorithmParametersSpi paramSpi;
private final AlgorithmParametersSpi paramSpi;
// The algorithm
private String algorithm;
private final String algorithm;
// Has this object been initialized?
private boolean initialized = false;
@ -131,7 +131,7 @@ public class AlgorithmParameters {
* {@code jdk.security.provider.preferred}
* {@link Security#getProperty(String) Security} property to determine
* the preferred provider order for the specified algorithm. This
* may be different than the order of providers returned by
* may be different from the order of providers returned by
* {@link Security#getProviders() Security.getProviders()}.
*
* @param algorithm the name of the algorithm requested.
@ -342,7 +342,7 @@ public class AlgorithmParameters {
* parameters should be returned in an instance of the
* {@code DSAParameterSpec} class.
*
* @param <T> the type of the parameter specification to be returrned
* @param <T> the type of the parameter specification to be returned
* @param paramSpec the specification class in which
* the parameters should be returned.
*
@ -356,7 +356,7 @@ public class AlgorithmParameters {
T getParameterSpec(Class<T> paramSpec)
throws InvalidParameterSpecException
{
if (this.initialized == false) {
if (!this.initialized) {
throw new InvalidParameterSpecException("not initialized");
}
return paramSpi.engineGetParameterSpec(paramSpec);
@ -374,7 +374,7 @@ public class AlgorithmParameters {
*/
public final byte[] getEncoded() throws IOException
{
if (this.initialized == false) {
if (!this.initialized) {
throw new IOException("not initialized");
}
return paramSpi.engineGetEncoded();
@ -396,7 +396,7 @@ public class AlgorithmParameters {
*/
public final byte[] getEncoded(String format) throws IOException
{
if (this.initialized == false) {
if (!this.initialized) {
throw new IOException("not initialized");
}
return paramSpi.engineGetEncoded(format);
@ -409,7 +409,7 @@ public class AlgorithmParameters {
* parameter object has not been initialized.
*/
public final String toString() {
if (this.initialized == false) {
if (!this.initialized) {
return null;
}
return paramSpi.engineToString();