8282158: ECParameters InvalidParameterSpecException messages missed ECKeySizeParameterSpec

Reviewed-by: xuelei
This commit is contained in:
John Jiang 2022-02-21 07:55:39 +00:00
parent 4e0b81c596
commit 52a85d8048

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2006, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -23,7 +23,7 @@
* questions. * questions.
*/ */
package sun.security.util; package java.security;
import java.io.IOException; import java.io.IOException;
@ -122,8 +122,9 @@ public final class ECParameters extends AlgorithmParametersSpi {
int keySize = ((ECKeySizeParameterSpec)paramSpec).getKeySize(); int keySize = ((ECKeySizeParameterSpec)paramSpec).getKeySize();
namedCurve = CurveDB.lookup(keySize); namedCurve = CurveDB.lookup(keySize);
} else { } else {
throw new InvalidParameterSpecException throw new InvalidParameterSpecException(
("Only ECParameterSpec and ECGenParameterSpec supported"); "Only ECParameterSpec, ECGenParameterSpec " +
"and ECKeySizeParameterSpec supported");
} }
if (namedCurve == null) { if (namedCurve == null) {
@ -213,7 +214,8 @@ public final class ECParameters extends AlgorithmParametersSpi {
} }
throw new InvalidParameterSpecException( throw new InvalidParameterSpecException(
"Only ECParameterSpec and ECGenParameterSpec supported"); "Only ECParameterSpec, ECGenParameterSpec " +
"and ECKeySizeParameterSpec supported");
} }
protected byte[] engineGetEncoded() throws IOException { protected byte[] engineGetEncoded() throws IOException {
@ -233,4 +235,3 @@ public final class ECParameters extends AlgorithmParametersSpi {
return namedCurve.toString(); return namedCurve.toString();
} }
} }