[sonar] fix
This commit is contained in:
@@ -154,6 +154,6 @@ final class Platform {
|
||||
* {@code x}, emulating the behavior of {@link BigDecimal#BigDecimal(double)}.
|
||||
*/
|
||||
static BigDecimal newBigDecimal(double x) {
|
||||
return new BigDecimal(x);
|
||||
return BigDecimal.valueOf(x);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -284,18 +284,16 @@ strictfp class Real extends Number {
|
||||
|
||||
/** Returns a BigDecimal representation of this extended precision real value. */
|
||||
public BigDecimal bigValue() {
|
||||
BigDecimal sum = new BigDecimal(values[0]);
|
||||
BigDecimal sum = BigDecimal.valueOf(values[0]);
|
||||
for (int i = 1; i < values.length; i++) {
|
||||
sum = sum.add(new BigDecimal(values[i]));
|
||||
sum = sum.add(BigDecimal.valueOf(values[i]));
|
||||
}
|
||||
return sum.stripTrailingZeros();
|
||||
}
|
||||
|
||||
private static double[] copyOf(double[] array, int newLength) {
|
||||
double[] result = new double[newLength];
|
||||
for (int i = 0; i < newLength; i++) {
|
||||
result[i] = array[i];
|
||||
}
|
||||
System.arraycopy(array, 0, result, 0, newLength);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,10 +17,10 @@ import java.security.MessageDigest;
|
||||
|
||||
public class GlideCircleBitmapTransform extends BitmapTransformation {
|
||||
|
||||
private int mBorderWidth;
|
||||
private int mBorderColor;
|
||||
private String mKey;
|
||||
private Context mContext;
|
||||
private final int mBorderWidth;
|
||||
private final int mBorderColor;
|
||||
private final String mKey;
|
||||
private final Context mContext;
|
||||
|
||||
public GlideCircleBitmapTransform( Context context, String key, int borderWidth, int borderColor ) {
|
||||
this.mContext = context;
|
||||
|
||||
@@ -133,7 +133,7 @@ public final class ActivityUtils {
|
||||
@Nullable
|
||||
private static Activity getActivityFromDecorContext(@Nullable Context context) {
|
||||
if (context == null) return null;
|
||||
if (context.getClass().getName().equals("com.android.internal.policy.DecorContext")) {
|
||||
if ("com.android.internal.policy.DecorContext".equals(context.getClass().getName())) {
|
||||
try {
|
||||
Field mActivityContextField = context.getClass().getDeclaredField("mActivityContext");
|
||||
mActivityContextField.setAccessible(true);
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.io.BufferedReader;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -308,10 +309,10 @@ public final class ShellUtils {
|
||||
successMsg = new StringBuilder();
|
||||
errorMsg = new StringBuilder();
|
||||
successResult = new BufferedReader(
|
||||
new InputStreamReader(process.getInputStream(), "UTF-8")
|
||||
new InputStreamReader(process.getInputStream(), StandardCharsets.UTF_8)
|
||||
);
|
||||
errorResult = new BufferedReader(
|
||||
new InputStreamReader(process.getErrorStream(), "UTF-8")
|
||||
new InputStreamReader(process.getErrorStream(), StandardCharsets.UTF_8)
|
||||
);
|
||||
String line;
|
||||
if ((line = successResult.readLine()) != null) {
|
||||
@@ -334,17 +335,9 @@ public final class ShellUtils {
|
||||
if (os != null) {
|
||||
os.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
if (successResult != null) {
|
||||
successResult.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
if (errorResult != null) {
|
||||
errorResult.close();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user