Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 50 additions & 44 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ allprojects {
mavenCentral()
}

configurations.all {
configurations.configureEach {
resolutionStrategy {
dependencySubstitution {
// Substitution is to resolve CVE-2025-12183
Expand Down Expand Up @@ -392,7 +392,7 @@ configure(project.fineractJavaProjects) {
}

// Add performance optimizations
configurations.all {
configurations.configureEach {
resolutionStrategy {
cacheChangingModulesFor 0, 'seconds'
cacheDynamicVersionsFor 0, 'seconds'
Expand Down Expand Up @@ -440,40 +440,40 @@ configure(project.fineractJavaProjects) {
configurations {
api.setCanBeResolved(true)
}
tasks.withType(Copy) {
tasks.withType(Copy).configureEach {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
tasks.withType(JavaCompile) {
tasks.withType(JavaCompile).configureEach {
options.compilerArgs += [
"-Xlint:cast",
"-Xlint:auxiliaryclass",
"-Xlint:dep-ann",
"-Xlint:divzero",
"-Xlint:empty",
"-Xlint:exports",
"-Xlint:fallthrough",
"-Xlint:finally",
"-Xlint:module",
"-Xlint:opens",
"-Xlint:options",
"-Xlint:overloads",
"-Xlint:overrides",
"-Xlint:path",
"-Xlint:processing",
"-Xlint:removal",
"-Xlint:requires-automatic",
"-Xlint:requires-transitive-automatic",
"-Xlint:try",
"-Xlint:varargs",
"-Xlint:preview",
"-Xlint:static",
// -Werror needs to be disabled because EclipseLink's static weaving doesn't generate warning-free code
// and during an IntelliJ recompilation, it fails
//"-Werror",
"-Xmaxwarns",
"1500",
"-Xmaxerrs",
"1500"
"-Xlint:cast",
"-Xlint:auxiliaryclass",
"-Xlint:dep-ann",
"-Xlint:divzero",
"-Xlint:empty",
"-Xlint:exports",
"-Xlint:fallthrough",
"-Xlint:finally",
"-Xlint:module",
"-Xlint:opens",
"-Xlint:options",
"-Xlint:overloads",
"-Xlint:overrides",
"-Xlint:path",
"-Xlint:processing",
"-Xlint:removal",
"-Xlint:requires-automatic",
"-Xlint:requires-transitive-automatic",
"-Xlint:try",
"-Xlint:varargs",
"-Xlint:preview",
"-Xlint:static",
// -Werror needs to be disabled because EclipseLink's static weaving doesn't generate warning-free code
// and during an IntelliJ recompilation, it fails
//"-Werror",
"-Xmaxwarns",
"1500",
"-Xmaxerrs",
"1500"
]
// TODO FINERACT-959 (gradually) enable -Xlint:all (see "javac -help -X")

Expand Down Expand Up @@ -759,11 +759,13 @@ configure(project.fineractJavaProjects) {
]
}

tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
options.encoding = 'UTF-8'
// Ignore any errors during javadoc generation
failOnError = false
tasks.withType(Javadoc).tap {
configureEach {
options.addStringOption('Xdoclint:none', '-quiet')
options.encoding = 'UTF-8'
// Ignore any errors during javadoc generation
failOnError = false
}
}
}

Expand Down Expand Up @@ -899,17 +901,21 @@ cyclonedxBom {
includeLicenseText = true
}

task printSourceSetInformation() {
doLast{
tasks.register('printSourceSetInformation') {
doLast {
sourceSets.each { srcSet ->
println "["+srcSet.name+"]"
print "-->Source directories: "+srcSet.allJava.srcDirs+"\n"
print "-->Output directories: "+srcSet.output.classesDirs.files+"\n"
println "[" + srcSet.name + "]"
print "-->Source directories: " + srcSet.allJava.srcDirs + "\n"
print "-->Output directories: " + srcSet.output.classesDirs.files + "\n"
print "-->Compile classpath:\n"
srcSet.compileClasspath.files.each {
print " "+it.path+"\n"
print " " + it.path + "\n"
}
println ""
}
}
}

tasks.withType(Checkstyle).configureEach {
exclude("**/*.avsc")
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@
import org.apache.fineract.client.models.PutEntityTypeEntityIdDocumentsResponse;

/**
* This class was originally generated by OpenAPI Generator (https://openapi-generator.tech), but then had to be
* manually edited to manually fix https://issues.apache.org/jira/browse/FINERACT-1227. If we could fix our OpenAPI /
* This class was originally generated by <a href="https://openapi-generator.tech">OpenAPI Generator</a>, but then had
* to be manually edited to manually fix
* <a href="https://issues.apache.org/jira/browse/FINERACT-1227">FINERACT-1227</a>. If we could fix our OpenAPI /
* Swagger YAML generation from the JAX RS and OpenAPI annotation to have the correct notation for binary document files
* and images, then this could be removed again.
*/
Expand All @@ -40,16 +41,6 @@ public interface DocumentsApiFixed {
* the document description : Description of the document file : The file to be uploaded Mandatory Fields : file and
* description
*
* @param entityType
* entityType (required)
* @param entityId
* entityId (required)
* @param file
* (required)
* @param name
* name (optional)
* @param description
* description (optional)
* @return PostEntityTypeEntityIdDocumentsResponse
*/
@RequestLine("POST /v1/{entityType}/{entityId}/documents")
Expand Down Expand Up @@ -120,18 +111,6 @@ DocumentData getDocument(@Param("entityType") String entityType, @Param("entityI
* Update a Document Note: A document is updated using a Multi-part form upload Body Parts name Name or summary of
* the document description Description of the document file The file to be uploaded
*
* @param entityType
* entityType (required)
* @param entityId
* entityId (required)
* @param documentId
* documentId (required)
* @param file
* (optional)
* @param name
* name (optional)
* @param description
* description (optional)
* @return PutEntityTypeEntityIdDocumentsResponse
*/
@RequestLine("PUT /v1/{entityType}/{entityId}/documents/{documentId}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ final class CommandJsonMapper {
private static final String CLASS_ATTRIBUTE = "@class";
private final ObjectMapper mapper;

@SuppressWarnings("unchecked")
public <T> T map(JsonNode source) {
if (source == null) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public Class<?> getLastException() {

public Retry getRetryConfigurationForExecuteCommand() {
Class<? extends Throwable>[] exceptionList = fineractProperties.getRetry().getInstances().getExecuteCommand().getRetryExceptions();
RetryConfig.Builder configBuilder = buildCommonExecuteCommandConfiguration();
RetryConfig.Builder<Throwable> configBuilder = buildCommonExecuteCommandConfiguration();

if (exceptionList != null) {
configBuilder.retryOnException(ex -> {
Expand All @@ -71,7 +71,7 @@ public Retry getRetryConfigurationForExecuteCommand() {

public Retry getRetryConfigurationForBatchApiWithEnclosingTransaction() {
Class<? extends Throwable>[] exceptionList = fineractProperties.getRetry().getInstances().getExecuteCommand().getRetryExceptions();
RetryConfig.Builder configBuilder = buildCommonExecuteCommandConfiguration();
RetryConfig.Builder<Throwable> configBuilder = buildCommonExecuteCommandConfiguration();

if (exceptionList != null) {
configBuilder.retryOnException(ex -> {
Expand All @@ -89,10 +89,10 @@ public Retry getRetryConfigurationForBatchApiWithEnclosingTransaction() {
return registry.retry(BATCH_RETRY, config);
}

private RetryConfig.Builder buildCommonExecuteCommandConfiguration() {
private RetryConfig.Builder<Throwable> buildCommonExecuteCommandConfiguration() {
var props = fineractProperties.getRetry().getInstances().getExecuteCommand();

RetryConfig.Builder configBuilder = RetryConfig.custom().maxAttempts(props.getMaxAttempts());
RetryConfig.Builder<Throwable> configBuilder = RetryConfig.<Throwable>custom().maxAttempts(props.getMaxAttempts());

if (props.getWaitDuration() != null && props.getWaitDuration().toMillis() >= 0) {
if (Boolean.TRUE.equals(props.getEnableExponentialBackoff())) {
Expand All @@ -111,7 +111,7 @@ private RetryConfig.Builder buildCommonExecuteCommandConfiguration() {
}

public Retry getRetryConfigurationForCommandResultPersistence() {
RetryConfig.Builder configBuilder = buildCommonExecuteCommandConfiguration();
RetryConfig.Builder<Throwable> configBuilder = buildCommonExecuteCommandConfiguration();

configBuilder.retryOnException(e -> e instanceof RuntimeException && !(e instanceof CommandResultPersistenceException));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,12 @@ static <T extends Enum<T> & ApiFacingEnum<T>> StringEnumOptionData getStringEnum
}

default StringEnumOptionData getValueAsStringEnumOptionData() {
return new StringEnumOptionData(((Enum<T>) this).name(), getCode(), getHumanReadableName());
return new StringEnumOptionData(this.name(), getCode(), getHumanReadableName());
}

String getCode();

String getHumanReadableName();

String name();
}
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ public Boolean booleanObjectValueOfParameterNamed(final String parameterName) {
*/
public boolean booleanPrimitiveValueOfParameterNamed(final String parameterName) {
final Boolean value = this.fromApiJsonHelper.extractBooleanNamed(parameterName, this.parsedCommand);
return ObjectUtils.defaultIfNull(value, Boolean.FALSE);
return ObjectUtils.getIfNull(value, Boolean.FALSE);
}

public boolean isChangeInArrayParameterNamed(final String parameterName, final String[] existingValue) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import lombok.Getter;
import net.fortuna.ical4j.model.property.RRule;
import net.fortuna.ical4j.validate.ValidationException;
import org.apache.commons.collections4.CollectionUtils;
Expand All @@ -40,6 +41,7 @@
public class DataValidatorBuilder {

public static final String VALID_INPUT_SEPARATOR = "_";
@Getter
private final List<ApiParameterError> dataValidationErrors;
private String resource;
private String parameter;
Expand Down Expand Up @@ -78,10 +80,6 @@ public boolean hasError() {
return !dataValidationErrors.isEmpty();
}

public List<ApiParameterError> getDataValidationErrors() {
return dataValidationErrors;
}

public DataValidatorBuilder resource(final String resource) {
this.resource = resource;
return this;
Expand Down Expand Up @@ -629,7 +627,13 @@ public DataValidatorBuilder listNotEmpty() {
return this;
}

final List<Object> list = (List<Object>) this.value;
if (!(this.value instanceof List<?> list)) {
String validationErrorCode = "validation.msg." + this.resource + "." + this.parameter + ".is.not.list";
String defaultEnglishMessage = "The parameter `" + this.parameter + "` should be a list.";
final ApiParameterError error = ApiParameterError.parameterError(validationErrorCode, defaultEnglishMessage, this.parameter);
this.dataValidationErrors.add(error);
return this;
}
if (CollectionUtils.isEmpty(list)) {
String validationErrorCode = "validation.msg." + this.resource + "." + this.parameter + ".cannot.be.empty";
String defaultEnglishMessage = "The parameter `" + this.parameter + "` cannot be empty. You must select at least one.";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import jakarta.persistence.Column;
import jakarta.persistence.MappedSuperclass;
import java.io.Serial;
import java.time.LocalDateTime;
import java.util.Optional;
import org.springframework.data.domain.Auditable;
Expand All @@ -32,15 +33,11 @@
* instead of LocalDateTime for created and modified.
*
* Abstract base class for auditable entities. Stores the audit values in persistent fields.
*
* @param <U>
* the auditing type. Typically some kind of user.
* @param <PK>
* the type of the auditing type's identifier
*/
@MappedSuperclass
public abstract class AbstractAuditableCustom extends AbstractPersistableCustom<Long> implements Auditable<Long, Long, LocalDateTime> {

@Serial
private static final long serialVersionUID = 141481953116476081L;

@Column(name = "createdby_id")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,30 +116,27 @@ private static String getSqlClassCode(SQLException ex) {
private final DefaultExceptionMapper defaultExceptionMapper;

@NotNull
@SuppressWarnings("unchecked")
public <T extends RuntimeException> ExceptionMapper<T> findMostSpecificExceptionHandler(T exception) {
Class<?> clazz = exception.getClass();
do {
Set<String> exceptionMappers = createSet(ctx.getBeanNamesForType(forClassWithGenerics(ExceptionMapper.class, clazz)));
Set<String> fineractErrorMappers = createSet(ctx.getBeanNamesForType(FineractExceptionMapper.class));
SetUtils.SetView<String> intersection = SetUtils.intersection(exceptionMappers, fineractErrorMappers);
if (!intersection.isEmpty()) {
// noinspection unchecked
return (ExceptionMapper<T>) ctx.getBean(intersection.iterator().next());
}
if (!exceptionMappers.isEmpty()) {
// noinspection unchecked
return (ExceptionMapper<T>) ctx.getBean(exceptionMappers.iterator().next());
}
clazz = clazz.getSuperclass();
} while (!clazz.equals(Exception.class));
// noinspection unchecked
return (ExceptionMapper<T>) defaultExceptionMapper;
}

/**
* Returns an object of ErrorInfo type containing the information regarding the raised error.
*
* @param exception
* @return ErrorInfo
*/
public ErrorInfo handle(@NotNull RuntimeException exception) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ public interface ExternalEventProducer {
* Sends the created ExternalEvents
*
* @param partitions
* is a Map<Long, List<byte[]>> partitions, the key here the id of the aggregated root. The value is list
* of external events belong to the same key, serialized into byte array
* @throws AcknowledgementTimeoutException
* The value is list of external events belong to the same key, serialized into byte array
*/
void sendEvents(Map<Long, List<byte[]>> partitions) throws AcknowledgementTimeoutException;
}
Loading
Loading