Skip to content

Commit 9e16fed

Browse files
committed
Whitespace only checkstyle rules around tokens
Whitespace rules are added to enforce spacing surrounding various tokens to provide for a more consistent code style. Signed-off-by: Jason Katonica <katonica@us.ibm.com>
1 parent 81c6573 commit 9e16fed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+154
-143
lines changed

checkstyle.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<!--
33
###############################################################################
44
#
5-
# Copyright IBM Corp. 2023
5+
# Copyright IBM Corp. 2023, 2026
66
#
77
# This code is free software; you can redistribute it and/or modify it
88
# under the terms provided by IBM in the LICENSE file that accompanied
@@ -41,5 +41,8 @@
4141
<module name="UnusedImports"/>
4242
<module name="UnusedLocalVariable"/>
4343
<module name="WhitespaceAfter"/>
44+
<module name="WhitespaceAround">
45+
<property name="allowEmptyConstructors" value="true"/>
46+
</module>
4447
</module>
4548
</module>

src/main/java/com/ibm/crypto/plus/provider/AESCCMCipher.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,7 @@ protected int engineUpdate(ByteBuffer input, ByteBuffer output) throws ShortBuff
770770
}
771771

772772
private Runnable cleanOCKResources(byte[] Key, OCKContext ockContext) {
773-
return() -> {
773+
return () -> {
774774
try {
775775
if (ockContext != null) {
776776
CCMCipher.doCCM_cleanup(ockContext);

src/main/java/com/ibm/crypto/plus/provider/AESGCMCipher.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1445,7 +1445,7 @@ private void resetVars(boolean afterFailure) {
14451445
}
14461446

14471447
private Runnable cleanOCKResources(PrimitiveWrapper.ByteArray Key) {
1448-
return() -> {
1448+
return () -> {
14491449
try {
14501450
//JS00684 - Leave cleanup of internal variables to GCMCipher that caches them
14511451
if (Key.getValue() != null) {

src/main/java/com/ibm/crypto/plus/provider/AESKey.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright IBM Corp. 2023, 2025
2+
* Copyright IBM Corp. 2023, 2026
33
*
44
* This code is free software; you can redistribute it and/or modify it
55
* under the terms provided by IBM in the LICENSE file that accompanied
@@ -157,12 +157,12 @@ private void checkDestroyed() {
157157
}
158158

159159
private Runnable cleanOCKResources(byte[] key) {
160-
return() -> {
160+
return () -> {
161161
try {
162162
if (key != null) {
163163
Arrays.fill(key, (byte) 0x00);
164164
}
165-
} catch (Exception e){
165+
} catch (Exception e) {
166166
if (OpenJCEPlusProvider.getDebug() != null) {
167167
OpenJCEPlusProvider.getDebug().println("An error occurred while cleaning : " + e.getMessage());
168168
e.printStackTrace();

src/main/java/com/ibm/crypto/plus/provider/AESKeyWrapCipher.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ protected int engineGetOutputSize(int inputLen) {
187187
} else {
188188
result = Math.addExact(inputLen, 16);
189189
}
190-
return (result < 0? 0:result);
190+
return (result < 0 ? 0 : result);
191191
}
192192

193193
@Override

src/main/java/com/ibm/crypto/plus/provider/ChaCha20Key.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright IBM Corp. 2023, 2025
2+
* Copyright IBM Corp. 2023, 2026
33
*
44
* This code is free software; you can redistribute it and/or modify it
55
* under the terms provided by IBM in the LICENSE file that accompanied
@@ -160,12 +160,12 @@ private void checkDestroyed() {
160160
}
161161

162162
private Runnable cleanOCKResources(byte[] key) {
163-
return() -> {
163+
return () -> {
164164
try {
165165
if (key != null) {
166166
Arrays.fill(key, (byte) 0x00);
167167
}
168-
} catch (Exception e){
168+
} catch (Exception e) {
169169
if (OpenJCEPlusProvider.getDebug() != null) {
170170
OpenJCEPlusProvider.getDebug().println("An error occurred while cleaning : " + e.getMessage());
171171
e.printStackTrace();

src/main/java/com/ibm/crypto/plus/provider/DESedeKey.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright IBM Corp. 2023, 2025
2+
* Copyright IBM Corp. 2023, 2026
33
*
44
* This code is free software; you can redistribute it and/or modify it
55
* under the terms provided by IBM in the LICENSE file that accompanied
@@ -161,12 +161,12 @@ private void checkDestroyed() {
161161
}
162162

163163
private Runnable cleanOCKResources(byte[] key) {
164-
return() -> {
164+
return () -> {
165165
try {
166166
if (key != null) {
167167
Arrays.fill(key, (byte) 0x00);
168168
}
169-
} catch (Exception e){
169+
} catch (Exception e) {
170170
if (OpenJCEPlusProvider.getDebug() != null) {
171171
OpenJCEPlusProvider.getDebug().println("An error occurred while cleaning : " + e.getMessage());
172172
e.printStackTrace();

src/main/java/com/ibm/crypto/plus/provider/ECDSASignature.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ protected void engineSetParameter(AlgorithmParameterSpec params)
133133
throw new InvalidAlgorithmParameterException(
134134
"Parameters must be of type ECParameterSpec");
135135
}
136-
java.security.interfaces.ECKey key = (this.privateKey == null? this.publicKey : this.privateKey);
136+
java.security.interfaces.ECKey key = (this.privateKey == null ? this.publicKey : this.privateKey);
137137
if ((key != null) && !ECUtil.equals(ecparams, key.getParams())) {
138138
throw new InvalidAlgorithmParameterException(
139139
"Signature params does not match key params");

src/main/java/com/ibm/crypto/plus/provider/ECKeyPairGenerator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public final class ECKeyPairGenerator extends KeyPairGeneratorSpi {
2525
private static final boolean legacyECdefault = Boolean.parseBoolean(System.getProperty(EC_LEGACY_DEFAULT_KEYSIZE));
2626

2727
private OpenJCEPlusProvider provider = null;
28-
private int keysize = legacyECdefault? 256 : 384;
28+
private int keysize = legacyECdefault ? 256 : 384;
2929
private SecureRandom cryptoRandom = null;
3030
ECParameterSpec ecSpec;
3131
private ObjectIdentifier oid = null;

src/main/java/com/ibm/crypto/plus/provider/MLKEMImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public KEM.Encapsulated engineEncapsulate(int from, int to, String algorithm) {
109109
byte[] encapsulation = new byte[encapLen];
110110
byte[] secret = new byte[SECRETSIZE];
111111

112-
if (from < 0 || to > SECRETSIZE || ((to - from) < 0) || (from >= SECRETSIZE)){
112+
if (from < 0 || to > SECRETSIZE || ((to - from) < 0) || (from >= SECRETSIZE)) {
113113
throw new IndexOutOfBoundsException();
114114
}
115115
if (algorithm == null) {
@@ -191,7 +191,7 @@ public SecretKey engineDecapsulate(byte[] cipherText, int from, int to, String a
191191
throws DecapsulateException {
192192
byte[] secret;
193193

194-
if (from < 0 || to > SECRETSIZE || ((to - from) < 0) || (from >= SECRETSIZE)){
194+
if (from < 0 || to > SECRETSIZE || ((to - from) < 0) || (from >= SECRETSIZE)) {
195195
throw new IndexOutOfBoundsException();
196196
}
197197
if (algorithm == null || cipherText == null) {

0 commit comments

Comments
 (0)