Skip to content

Commit 6ff5577

Browse files
committed
Enforce checkstyle LeftCurly and RightCurly rules
This update makes whitespace only changes to enforce curly bracket location in the code base. Signed-off-by: Jason Katonica <[email protected]>
1 parent 0e86ed5 commit 6ff5577

37 files changed

+194
-421
lines changed

checkstyle.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,11 @@
2727
<property name="arrayInitIndent" value="8"/>
2828
<property name="caseIndent" value="4"/>
2929
</module>
30+
<module name="LeftCurly"/>
3031
<module name="NoWhitespaceAfter"/>
3132
<module name="NoWhitespaceBefore"/>
3233
<module name="RedundantImport"/>
34+
<module name="RightCurly"/>
3335
<module name="StringLiteralEquality"/>
3436
<module name="StringLiteralEquality"/>
3537
<module name="UnusedImports"/>

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,7 @@ protected int engineDoFinal(byte[] input, int inputOffset, int inputLen, byte[]
233233
throw new ShortBufferException(
234234
"The output buffer is too small to hold the encryption result.");
235235
}
236-
} else // decrypting
237-
{
236+
} else { // decrypting
238237
if ((output.length - outputOffset) < (input.length - tagLenInBytes)) {
239238
throw new ShortBufferException(
240239
"The output buffer is too small to hold the decryption result.");
@@ -276,8 +275,7 @@ protected int engineDoFinal(byte[] input, int inputOffset, int inputLen, byte[]
276275

277276
} else { // else decrypting
278277

279-
if ((input == null) || (input.length == 0)) // If this doFinal( ) carries no data to be encrypted
280-
{
278+
if ((input == null) || (input.length == 0)) { // If this doFinal( ) carries no data to be encrypted
281279
return 0;
282280
}
283281

@@ -715,8 +713,7 @@ protected void engineUpdateAAD(ByteBuffer src) {
715713
if (this.authData == null) {
716714
this.authData = new byte[src.remaining()];
717715
src.get(this.authData, 0, this.authData.length);
718-
} else // else this.authData != null
719-
{
716+
} else { // else this.authData != null
720717
byte[] tempAuthData = new byte[this.authData.length + src.remaining()];
721718
System.arraycopy(this.authData, 0, tempAuthData, 0, this.authData.length);
722719
src.get(tempAuthData, this.authData.length, src.remaining());

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,8 +1051,7 @@ protected int doUpdate(byte[] input, int inputOffset, int inputLen, byte[] outpu
10511051
// GCMCipher.do_GCM_UpdForUpdateDecrypt=" + outLen);
10521052

10531053
// outLen = cipher.decrypt(buffer, 0, len, output, outputOffset);
1054-
} // decrypting
1055-
else {
1054+
} else { // decrypting
10561055
// OCKDebug.Msg(debPrefix, methodName, "Encrypting");
10571056
// OCKDebug.Msg(debPrefix, methodName, "FirstUpdate generateIV");
10581057

@@ -1093,8 +1092,7 @@ protected int doUpdate(byte[] input, int inputOffset, int inputLen, byte[] outpu
10931092
tagLenInBytes, buffer, 0, buffered, output, outputOffset,
10941093
authData, provider);
10951094
// outLen = cipher.decrypt(buffer, 0, buffered, output, outputOffset);
1096-
} // decrypting
1097-
else {
1095+
} else { // decrypting
10981096
outLen = GCMCipher.do_GCM_UpdForUpdateEncrypt(ockContext, Key, IV,
10991097
tagLenInBytes, buffer, 0, buffered, output, outputOffset,
11001098
authData, provider);

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,7 @@ protected void engineInit(byte[] encoded) throws IOException {
111111
if (value.getData().available() != 0) {
112112
throw new IOException("CCM parameter parsing error: Extra data is present.");
113113
}
114-
} else // else no tag length present
115-
{
114+
} else { // else no tag length present
116115
throw new InvalidParameterException(
117116
"CCM parameters parsing error: No tag length is present.");
118117
}

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -265,9 +265,7 @@ protected void engineSetMode(String mode) throws NoSuchAlgorithmException {
265265
* modeUpperCase.equals("CFB")
266266
*/) {
267267
this.mode = modeUpperCase;
268-
} /*
269-
* else if (modeUpperCase.equals("CFB64")) { this.mode = "CFB"; }
270-
*/ else {
268+
} else {
271269
throw new NoSuchAlgorithmException("Cipher mode: " + mode + " not found");
272270
}
273271
}

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,7 @@ public boolean isDestroyed() {
138138
*/
139139
@java.io.Serial
140140
private void readObject(java.io.ObjectInputStream s)
141-
throws IOException, ClassNotFoundException
142-
{
141+
throws IOException, ClassNotFoundException {
143142
s.defaultReadObject();
144143
if (key == null) {
145144
throw new InvalidObjectException(

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,7 @@ public PBEWithHmacSHA512_256AndAES_256(OpenJCEPlusProvider provider) {
133133
* is inappropriate for this key factory to produce a public key.
134134
*/
135135
protected SecretKey engineGenerateSecret(KeySpec keySpec)
136-
throws InvalidKeySpecException
137-
{
136+
throws InvalidKeySpecException {
138137
if (!(keySpec instanceof PBEKeySpec)) {
139138
throw new InvalidKeySpecException("Invalid key spec");
140139
}
@@ -194,8 +193,7 @@ protected KeySpec engineGetKeySpec(SecretKey key, Class<?> keySpecCl)
194193
* this key factory.
195194
*/
196195
protected SecretKey engineTranslateKey(SecretKey key)
197-
throws InvalidKeyException
198-
{
196+
throws InvalidKeyException {
199197
try {
200198
if ((key != null) && (key.getFormat() != null) && (key.getFormat().equalsIgnoreCase("RAW"))) {
201199

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

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,7 @@ abstract class PBES2Parameters extends AlgorithmParametersSpi {
181181
}
182182

183183
protected void engineInit(AlgorithmParameterSpec paramSpec)
184-
throws InvalidParameterSpecException
185-
{
184+
throws InvalidParameterSpecException {
186185
if (!(paramSpec instanceof PBEParameterSpec)) {
187186
throw new InvalidParameterSpecException ("Inappropriate parameter specification");
188187
}
@@ -192,8 +191,7 @@ protected void engineInit(AlgorithmParameterSpec paramSpec)
192191
}
193192

194193
protected void engineInit(byte[] encoded)
195-
throws IOException
196-
{
194+
throws IOException {
197195
DerValue pBES2_params = new DerValue(encoded);
198196
if (pBES2_params.tag != DerValue.tag_Sequence) {
199197
throw new IOException("PBE parameter parsing error: "
@@ -307,15 +305,13 @@ private String parseES(DerValue encryptionScheme) throws IOException {
307305
}
308306

309307
protected void engineInit(byte[] encoded, String decodingMethod)
310-
throws IOException
311-
{
308+
throws IOException {
312309
engineInit(encoded);
313310
}
314311

315312
protected <T extends AlgorithmParameterSpec>
316313
T engineGetParameterSpec(Class<T> paramSpec)
317-
throws InvalidParameterSpecException
318-
{
314+
throws InvalidParameterSpecException {
319315
if (paramSpec.isAssignableFrom(PBEParameterSpec.class)) {
320316
return paramSpec.cast(
321317
new PBEParameterSpec(this.salt, this.iCount, this.cipherParam));
@@ -368,8 +364,7 @@ protected byte[] engineGetEncoded() throws IOException {
368364
}
369365

370366
protected byte[] engineGetEncoded(String encodingMethod)
371-
throws IOException
372-
{
367+
throws IOException {
373368
return engineGetEncoded();
374369
}
375370

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

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -381,47 +381,37 @@ protected void engineSetParameter(AlgorithmParameterSpec params)
381381
|| mgfMessageDigest.equalsIgnoreCase("SHA")) {
382382
throwException = false;
383383
}
384-
}
385-
386-
else if (messageDigest.equalsIgnoreCase("SHA224")
384+
} else if (messageDigest.equalsIgnoreCase("SHA224")
387385
|| messageDigest.equalsIgnoreCase("SHA-224")) {
388386
if (mgfMessageDigest.equalsIgnoreCase("SHA224")
389387
|| mgfMessageDigest.equalsIgnoreCase("SHA-224")) {
390388
throwException = false;
391389
}
392-
}
393-
394-
else if (messageDigest.equalsIgnoreCase("SHA256")
390+
} else if (messageDigest.equalsIgnoreCase("SHA256")
395391
|| messageDigest.equalsIgnoreCase("SHA-256")
396392
|| messageDigest.equalsIgnoreCase("SHA2")) {
397393
if (mgfMessageDigest.equalsIgnoreCase("SHA256")
398394
|| mgfMessageDigest.equalsIgnoreCase("SHA-256")
399395
|| mgfMessageDigest.equalsIgnoreCase("SHA2")) {
400396
throwException = false;
401397
}
402-
}
403-
404-
else if (messageDigest.equalsIgnoreCase("SHA384")
398+
} else if (messageDigest.equalsIgnoreCase("SHA384")
405399
|| messageDigest.equalsIgnoreCase("SHA-384")
406400
|| messageDigest.equalsIgnoreCase("SHA3")) {
407401
if (mgfMessageDigest.equalsIgnoreCase("SHA384")
408402
|| mgfMessageDigest.equalsIgnoreCase("SHA-384")
409403
|| mgfMessageDigest.equalsIgnoreCase("SHA3")) {
410404
throwException = false;
411405
}
412-
}
413-
414-
else if (messageDigest.equalsIgnoreCase("SHA512")
406+
} else if (messageDigest.equalsIgnoreCase("SHA512")
415407
|| messageDigest.equalsIgnoreCase("SHA-512")
416408
|| messageDigest.equalsIgnoreCase("SHA5")) {
417409
if (mgfMessageDigest.equalsIgnoreCase("SHA512")
418410
|| mgfMessageDigest.equalsIgnoreCase("SHA-512")
419411
|| mgfMessageDigest.equalsIgnoreCase("SHA5")) {
420412
throwException = false;
421413
}
422-
}
423-
424-
else if (messageDigest.equalsIgnoreCase("SHA512/224")
414+
} else if (messageDigest.equalsIgnoreCase("SHA512/224")
425415
|| messageDigest.equalsIgnoreCase("SHA-512/224")) {
426416
if (mgfMessageDigest.equalsIgnoreCase("SHA512/224")
427417
|| mgfMessageDigest.equalsIgnoreCase("SHA-512/224")) {

src/test/java/ibm/jceplus/junit/base/BaseTestAES.java

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -781,9 +781,7 @@ protected void encryptDecrypt(String algorithm, boolean requireLengthMultipleBlo
781781
// Run encrypt/decrypt test using just doFinal calls
782782
//
783783
protected void encryptDecryptDoFinal(String algorithm, boolean requireLengthMultipleBlockSize,
784-
AlgorithmParameters algParams, byte[] message, Cipher cp) throws Exception
785-
786-
{
784+
AlgorithmParameters algParams, byte[] message, Cipher cp) throws Exception {
787785
if (algParams == null) {
788786
cp.init(Cipher.ENCRYPT_MODE, key);
789787
} else {
@@ -914,9 +912,7 @@ protected void encryptDecryptPartialUpdate(String algorithm,
914912
//
915913
protected void encryptDecryptReuseObject(String algorithm,
916914
boolean requireLengthMultipleBlockSize, AlgorithmParameters algParams, byte[] message, Cipher cp)
917-
throws Exception
918-
919-
{
915+
throws Exception {
920916
if (algParams == null) {
921917
cp.init(Cipher.ENCRYPT_MODE, key);
922918
} else {
@@ -960,9 +956,7 @@ protected void encryptDecryptReuseObject(String algorithm,
960956
//
961957
protected void encryptDecryptDoFinalCopySafe(String algorithm,
962958
boolean requireLengthMultipleBlockSize, AlgorithmParameters algParams, byte[] message, Cipher cp)
963-
throws Exception
964-
965-
{
959+
throws Exception {
966960
if (algParams == null) {
967961
cp.init(Cipher.ENCRYPT_MODE, key);
968962
} else {
@@ -1007,9 +1001,7 @@ protected void encryptDecryptDoFinalCopySafe(String algorithm,
10071001
//
10081002
protected void encryptDecryptUpdateCopySafe(String algorithm,
10091003
boolean requireLengthMultipleBlockSize, AlgorithmParameters algParams, byte[] message, Cipher cp)
1010-
throws Exception
1011-
1012-
{
1004+
throws Exception {
10131005
if (algParams == null) {
10141006
cp.init(Cipher.ENCRYPT_MODE, key);
10151007
} else {

0 commit comments

Comments
 (0)