fixed sonar rule violations

This commit is contained in:
wenshao
2012-08-29 15:36:45 +08:00
parent c96af1628e
commit 5c6d5fcadc
17 changed files with 206 additions and 211 deletions
@@ -124,7 +124,9 @@ public class Base64 {
byte[] alphaToInt = (alternate ? altBase64ToInt : base64ToInt);
int sLen = s.length();
int numGroups = sLen / 4;
if (4 * numGroups != sLen) throw new IllegalArgumentException("String length must be a multiple of four.");
if (4 * numGroups != sLen) {
throw new IllegalArgumentException("String length must be a multiple of four.");
}
int missingBytesInLastGroup = 0;
int numFullGroups = numGroups;
if (sLen != 0) {
@@ -132,7 +134,9 @@ public class Base64 {
missingBytesInLastGroup++;
numFullGroups--;
}
if (s.charAt(sLen - 2) == '=') missingBytesInLastGroup++;
if (s.charAt(sLen - 2) == '=') {
missingBytesInLastGroup++;
}
}
byte[] result = new byte[3 * numGroups - missingBytesInLastGroup];
@@ -172,7 +176,9 @@ public class Base64 {
*/
private static int base64toInt(char c, byte[] alphaToInt) {
int result = alphaToInt[c];
if (result < 0) throw new IllegalArgumentException("Illegal character " + c);
if (result < 0) {
throw new IllegalArgumentException("Illegal character " + c);
}
return result;
}