mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
fixed sonar rule violations
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user