FINERACT-2421: Refractor redundant and some deprecated code as per new Java 21 style (Phase 5)
This commit is contained in:
+1
-1
@@ -79,7 +79,7 @@ public class FineractErrorDecoder implements ErrorDecoder {
|
||||
|
||||
private String extractValidationErrors(JsonNode rootNode) {
|
||||
JsonNode errorsNode = rootNode.get("errors");
|
||||
if (errorsNode != null && errorsNode.isArray() && errorsNode.size() > 0) {
|
||||
if (errorsNode != null && errorsNode.isArray() && !errorsNode.isEmpty()) {
|
||||
StringBuilder errors = new StringBuilder("Validation errors: ");
|
||||
for (JsonNode error : errorsNode) {
|
||||
String parameterName = extractField(error, "parameterName");
|
||||
|
||||
+8
-16
@@ -77,21 +77,13 @@ public interface ImagesApi {
|
||||
}
|
||||
String ext = fileName.substring(dotPos + 1).toLowerCase();
|
||||
|
||||
switch (ext) {
|
||||
case "jpg":
|
||||
case "jpeg":
|
||||
return "image/jpeg";
|
||||
case "png":
|
||||
return "image/png";
|
||||
case "gif":
|
||||
return "image/gif";
|
||||
case "tif":
|
||||
case "tiff":
|
||||
return "image/tiff";
|
||||
case "pdf":
|
||||
return "application/pdf";
|
||||
default:
|
||||
return "application/octet-stream";
|
||||
}
|
||||
return switch (ext) {
|
||||
case "jpg", "jpeg" -> "image/jpeg";
|
||||
case "png" -> "image/png";
|
||||
case "gif" -> "image/gif";
|
||||
case "tif", "tiff" -> "image/tiff";
|
||||
case "pdf" -> "application/pdf";
|
||||
default -> "application/octet-stream";
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
+2
-4
@@ -60,8 +60,7 @@ public final class ApiResponseDecoder implements Decoder {
|
||||
}
|
||||
|
||||
private boolean isApiResponseType(Type type) {
|
||||
if (type instanceof ParameterizedType) {
|
||||
ParameterizedType paramType = (ParameterizedType) type;
|
||||
if (type instanceof ParameterizedType paramType) {
|
||||
Type rawType = paramType.getRawType();
|
||||
return rawType == ApiResponse.class;
|
||||
}
|
||||
@@ -69,8 +68,7 @@ public final class ApiResponseDecoder implements Decoder {
|
||||
}
|
||||
|
||||
private Type getApiResponseInnerType(Type type) {
|
||||
if (type instanceof ParameterizedType) {
|
||||
ParameterizedType paramType = (ParameterizedType) type;
|
||||
if (type instanceof ParameterizedType paramType) {
|
||||
Type[] typeArgs = paramType.getActualTypeArguments();
|
||||
if (typeArgs.length > 0) {
|
||||
return typeArgs[0];
|
||||
|
||||
Reference in New Issue
Block a user