Skip to content

Commit 0223deb

Browse files
Enforce checkstyle LeftCurly and RightCurly rules (#983)
This update makes whitespace only changes to enforce curly bracket location in the code base. Signed-off-by: Jason Katonica <[email protected]>
1 parent cdd178f commit 0223deb

36 files changed

+187
-403
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.getValue(), 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/DHPrivateKey.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ private void initDHPrivateKey(OpenJCEPlusProvider provider, BigInteger x, DHPara
112112
id.putDerValue(new DerValue(dhKey.getParameters()));
113113
DerValue value = new DerValue(DerValue.tag_Sequence, id.toByteArray());
114114
this.algid = AlgorithmId.parse(value);
115-
};
115+
}
116116

117117
convertOCKPrivateKeyBytes(dhKey.getPrivateKeyBytes());
118118
this.dhKey = dhKey;

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,7 @@ public boolean isDestroyed() {
140140
* @throws ClassNotFoundException if a serialized class cannot be loaded
141141
*/
142142
private void readObject(java.io.ObjectInputStream s)
143-
throws IOException, ClassNotFoundException
144-
{
143+
throws IOException, ClassNotFoundException {
145144
s.defaultReadObject();
146145
if (key == null) {
147146
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
@@ -105,8 +105,7 @@ public PBEWithHmacSHA512AndAES_256(OpenJCEPlusProvider provider) {
105105
* is inappropriate for this key factory to produce a public key.
106106
*/
107107
protected SecretKey engineGenerateSecret(KeySpec keySpec)
108-
throws InvalidKeySpecException
109-
{
108+
throws InvalidKeySpecException {
110109
if (!(keySpec instanceof PBEKeySpec)) {
111110
throw new InvalidKeySpecException("Invalid key spec");
112111
}
@@ -166,8 +165,7 @@ protected KeySpec engineGetKeySpec(SecretKey key, Class<?> keySpecCl)
166165
* this key factory.
167166
*/
168167
protected SecretKey engineTranslateKey(SecretKey key)
169-
throws InvalidKeyException
170-
{
168+
throws InvalidKeyException {
171169
try {
172170
if ((key != null) && (key.getFormat() != null) && (key.getFormat().equalsIgnoreCase("RAW"))) {
173171

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

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

181181
protected void engineInit(AlgorithmParameterSpec paramSpec)
182-
throws InvalidParameterSpecException
183-
{
182+
throws InvalidParameterSpecException {
184183
if (!(paramSpec instanceof PBEParameterSpec)) {
185184
throw new InvalidParameterSpecException ("Inappropriate parameter specification");
186185
}
@@ -190,8 +189,7 @@ protected void engineInit(AlgorithmParameterSpec paramSpec)
190189
}
191190

192191
protected void engineInit(byte[] encoded)
193-
throws IOException
194-
{
192+
throws IOException {
195193
DerValue pBES2_params = new DerValue(encoded);
196194
if (pBES2_params.tag != DerValue.tag_Sequence) {
197195
throw new IOException("PBE parameter parsing error: "
@@ -318,15 +316,13 @@ private String parseES(DerValue encryptionScheme) throws IOException {
318316
}
319317

320318
protected void engineInit(byte[] encoded, String decodingMethod)
321-
throws IOException
322-
{
319+
throws IOException {
323320
engineInit(encoded);
324321
}
325322

326323
protected <T extends AlgorithmParameterSpec>
327324
T engineGetParameterSpec(Class<T> paramSpec)
328-
throws InvalidParameterSpecException
329-
{
325+
throws InvalidParameterSpecException {
330326
if (paramSpec.isAssignableFrom(PBEParameterSpec.class)) {
331327
return paramSpec.cast(
332328
new PBEParameterSpec(this.salt, this.iCount, this.cipherParam));
@@ -379,8 +375,7 @@ protected byte[] engineGetEncoded() throws IOException {
379375
}
380376

381377
protected byte[] engineGetEncoded(String encodingMethod)
382-
throws IOException
383-
{
378+
throws IOException {
384379
return engineGetEncoded();
385380
}
386381

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")) {

0 commit comments

Comments
 (0)