diff --git a/.gitignore b/.gitignore
index 2ac403bc5..ce351bad0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,5 +15,18 @@ out
.checkstyle
pom.xml
release.sh
-.idea/*
-*.pb
\ No newline at end of file
+.idea/gradle.xml
+.idea/jarRepositories.xml
+.idea/misc.xml
+.idea/modules.xml
+.idea/prowide-core.iml
+.idea/uiDesigner.xml
+.idea/vcs.xml
+.idea/workspace.xml
+.idea/libraries-with-intellij-classes.xml
+.idea/jpa-buddy.xml
+.idea/runConfigurations.xml
+.idea/.name
+*.pb
+.java-version
+.idea/sonarlint/
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
index 61a9130cd..fb7f4a8a4 100644
--- a/.idea/compiler.xml
+++ b/.idea/compiler.xml
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
index af04678b6..f2366a5ba 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,69 +1,72 @@
# Prowide Core - CHANGELOG
-#### 9.4.18 - October 2024
+#### 10.1.17 - October 2024
* Added new `FieldEnum` with all the available field names
* Code security improvements as per CodeQL recommendations
-#### 9.4.17 - June 2024
+#### 10.1.16 - June 2024
* (PW-1913) Added IBAN validation for Egypt local account structure
-#### 9.4.16 - May 2024
+#### 10.1.15 - May 2024
* (PW-1862) Added NarrativeFragment class for detailed line information in StructuredNarrative fragments
* Fixed SwiftMessage getPDE(): return empty value instead of null when codeword exists and has no value
* Added isPercentage() helper method to field 37K
-#### 9.4.15 - March 2024
+#### 10.1.14 - March 2024
* (PW-1812) Updated the narrative resolver, format 2 (used in field 72 for example), to allow empty values as part of the narrative fragment
* Updated validators for BIC, country, and currency constraints to utilize keywords for i18n-compatible messages
* Deprecated unnecessary methods in the SafeXmlUtils class
-#### 9.4.14 - December 2023
+#### 10.1.13 - December 2023
* (PW-1718) Changed the getComponentLabel(component) in Field59F to be dynamic based on the line identifiers (similar to existing API in Field50F)
-#### 9.4.13 - November 2023
+#### 10.1.12 - November 2023
* (PW-1697) Fixed validation/parse pattern in field 29O
* (PW-1697) MT306 changes in field 30I
- * Added DistinguishedName with Builder in order to encapsulate the BIC branch name logic
+ * Added DistinguishedName with Builder to encapsulate the BIC branch name logic
-#### 9.4.12 - November 2023
+#### 10.1.11 - November 2023
* (PW-1697) Fixed validation pattern in fields 14[H,K,L,M,N,O] and 29J
-#### 9.4.11 - November 2023
+#### 10.1.10 - November 2023
* (PW-1695) Fixed a stack overflow in the fields fromJson implementation when a malformed JSON input contains empty field names
* (PW-1688) Added missing field labels for SRU2023 changes in the pw_swift_*.properties file
-#### 9.4.10 - October 2023
+#### 10.1.9 - October 2023
* (PW-1675) update to Field 31R to support also two date components as requested by SCORE messages
* Added 36B and 36D getters to MT543
-#### 9.4.9 - October 2023
+#### 10.1.8 - October 2023
* (PW-1659) Field 24G deprecated Name and Address for Narrative
-#### 9.4.8 - October 2023
+#### 10.1.7 - October 2023
* Added default methods for sender, receiver, and identifier extraction to the MessageExtractionStrategy
* Added JSON to the `FileFormat` enumeration
-#### 9.4.7 - September 2023
+#### 10.1.6 - September 2023
* (PW-1478) Fixed Field 44J parse and getValue to enable proper data preservation when the field contains multiline content
-#### 9.4.6 - September 2023
+#### 10.1.5 - September 2023
* Added support for an optional `pw-swift-core.properties` to customize the behavior of the SafeXmlUtils class
-#### 9.4.5 - August 2023
+#### 10.1.4 - September 2023
* (PW-1478) Field 44J parse and getValue fix
-#### 9.4.4 - August 2023
+#### 10.1.3 - August 2023
* (PW-1478) Field 44J format fixed to allow multiline
-#### 9.4.3 - July 2023
+#### 10.1.2 - August 2023
* (PW-1461) Remove deprecation of field 31R model since is it used back in SRU2023
* (PW-1405) Trim original String payload when creating an AbstractSwiftMessage
-#### 9.4.2 - June 2023
+#### 10.1.1 - July 2023
* (GH-163) Remove unnecessary padding in sender and receiver in AbstractMT#creeate(number, sender, receiver) method
* (PW-1323) Fixing getValue method for pattern issue in Field44J
-#### 9.4.1 - June 2023
+#### 10.1.0 - June 2023
+ * Migration to Java 11
+ * Migration to Jakarta EE 10
+ * (PW-1323) Fixing getValue method for pattern issue in Field44J
* (PW-1323) Fixing missing pattern issue in Field44J
#### 9.4.0 - May 2023
diff --git a/build.gradle b/build.gradle
index c94374e0b..2278a22ed 100644
--- a/build.gradle
+++ b/build.gradle
@@ -4,10 +4,10 @@ buildscript {
gradlePluginPortal()
}
dependencies {
- classpath 'ru.vyarus:gradle-quality-plugin:4.7.0'
- classpath 'pl.allegro.tech.build:axion-release-plugin:1.14.2'
+ classpath 'ru.vyarus:gradle-quality-plugin:4.9.0'
+ classpath 'pl.allegro.tech.build:axion-release-plugin:1.15.1'
classpath 'io.github.gradle-nexus:publish-plugin:2.0.0'
- classpath 'com.diffplug.spotless:spotless-plugin-gradle:6.13.0' // above this version requires Java 11
+ classpath 'com.diffplug.spotless:spotless-plugin-gradle:6.23.3'
}
}
apply plugin: 'pl.allegro.tech.build.axion-release'
@@ -39,7 +39,7 @@ tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
java {
toolchain {
- languageVersion.set(JavaLanguageVersion.of(8))
+ languageVersion.set(JavaLanguageVersion.of(11))
}
}
doFirst {
@@ -55,12 +55,14 @@ dependencies {
implementation 'org.apache.commons:commons-lang3:3.12.0'
implementation 'com.google.code.gson:gson:2.9.0'
- compileOnly 'javax.persistence:javax.persistence-api:2.2'
- compileOnly 'javax.xml.bind:jaxb-api:2.3.1'
- compileOnly 'javax.validation:validation-api:2.0.1.Final'
+ // jakarta is only used for annotations, we do not add it as implementation dependency on purpose to avoid forcing
+ // users to use jakarta jars in their project when they might not event be using JPA or JAXB at all
+ compileOnly 'jakarta.persistence:jakarta.persistence-api:3.1.0'
+ compileOnly 'jakarta.xml.bind:jakarta.xml.bind-api:4.0.0'
+ compileOnly 'jakarta.validation:jakarta.validation-api:3.0.2'
- testImplementation 'javax.validation:validation-api:2.0.1.Final'
- testImplementation 'javax.persistence:javax.persistence-api:2.2'
+ testImplementation 'jakarta.persistence:jakarta.persistence-api:3.1.0'
+ testImplementation 'jakarta.validation:jakarta.validation-api:3.1.0'
testImplementation('org.junit.jupiter:junit-jupiter:5.8.2')
testImplementation group: 'org.assertj', name: 'assertj-core', version: '3.22.0'
testImplementation group: 'org.xmlunit', name: 'xmlunit-core', version: '2.9.0'
@@ -68,7 +70,11 @@ dependencies {
testImplementation group: 'org.xmlunit', name: 'xmlunit-assertj', version: '2.9.0'
}
-sourceSets.main.java.srcDirs = ['src/main/java', 'src/generated/java']
+sourceSets.named('main') {
+ java {
+ setSrcDirs(['src/main/java', 'src/generated/java'])
+ }
+}
test {
useJUnitPlatform()
@@ -83,8 +89,8 @@ tasks.withType(Jar) {
'Implementation-Version': project.version,
'Implementation-Vendor': 'www.prowidesoftware.com',
'Built-OS': System.getProperty('os.name'),
- 'Source-Compatibility': project.sourceCompatibility,
- 'Target-Compatibility': project.targetCompatibility,
+ 'Source-Compatibility': JavaVersion.VERSION_11,
+ 'Target-Compatibility': JavaVersion.VERSION_11,
'Built-Date': new Date().format("yyyy-MM-dd"),
'Automatic-Module-Name': 'com.prowidesoftware.core'
)
@@ -259,7 +265,7 @@ tasks.register('bundle', Jar) {
from ("$buildDir/libs") {
include '*.asc'
}
- archiveName 'bundle.jar'
+ archiveFileName.set('bundle.jar')
}
tasks.withType(Test) {
@@ -282,9 +288,15 @@ task('testOn17', type: Test) {
jacocoTestReport {
reports {
- xml.enabled true
- csv.enabled false
- html.enabled false
+ xml {
+ required.set(true)
+ }
+ csv {
+ required.set(false)
+ }
+ html {
+ required.set(false)
+ }
}
// exclude generated code
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index c7d437bbb..3499ded5c 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.4-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/src/main/java/com/prowidesoftware/swift/constraints/BicConstraint.java b/src/main/java/com/prowidesoftware/swift/constraints/BicConstraint.java
index 4063ee521..025099001 100644
--- a/src/main/java/com/prowidesoftware/swift/constraints/BicConstraint.java
+++ b/src/main/java/com/prowidesoftware/swift/constraints/BicConstraint.java
@@ -17,12 +17,12 @@
import static java.lang.annotation.ElementType.*;
+import jakarta.validation.Constraint;
+import jakarta.validation.Payload;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
-import javax.validation.Constraint;
-import javax.validation.Payload;
/**
* Bean validation for BIC numbers.
diff --git a/src/main/java/com/prowidesoftware/swift/constraints/BicValidator.java b/src/main/java/com/prowidesoftware/swift/constraints/BicValidator.java
index 7a5909d36..90baf9228 100644
--- a/src/main/java/com/prowidesoftware/swift/constraints/BicValidator.java
+++ b/src/main/java/com/prowidesoftware/swift/constraints/BicValidator.java
@@ -17,8 +17,8 @@
import com.prowidesoftware.swift.model.BIC;
import com.prowidesoftware.swift.model.BicValidationResult;
-import javax.validation.ConstraintValidator;
-import javax.validation.ConstraintValidatorContext;
+import jakarta.validation.ConstraintValidator;
+import jakarta.validation.ConstraintValidatorContext;
import org.apache.commons.lang3.StringUtils;
/**
diff --git a/src/main/java/com/prowidesoftware/swift/constraints/CountryConstraint.java b/src/main/java/com/prowidesoftware/swift/constraints/CountryConstraint.java
index b58fad4d9..cca0811e4 100644
--- a/src/main/java/com/prowidesoftware/swift/constraints/CountryConstraint.java
+++ b/src/main/java/com/prowidesoftware/swift/constraints/CountryConstraint.java
@@ -17,12 +17,12 @@
import static java.lang.annotation.ElementType.*;
+import jakarta.validation.Constraint;
+import jakarta.validation.Payload;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
-import javax.validation.Constraint;
-import javax.validation.Payload;
/**
* Bean validation for ISO Alpha-2 country codes.
diff --git a/src/main/java/com/prowidesoftware/swift/constraints/CountryValidator.java b/src/main/java/com/prowidesoftware/swift/constraints/CountryValidator.java
index ab8b50504..59c6a0a92 100644
--- a/src/main/java/com/prowidesoftware/swift/constraints/CountryValidator.java
+++ b/src/main/java/com/prowidesoftware/swift/constraints/CountryValidator.java
@@ -16,8 +16,8 @@
package com.prowidesoftware.swift.constraints;
import com.prowidesoftware.swift.utils.IsoUtils;
-import javax.validation.ConstraintValidator;
-import javax.validation.ConstraintValidatorContext;
+import jakarta.validation.ConstraintValidator;
+import jakarta.validation.ConstraintValidatorContext;
import org.apache.commons.lang3.StringUtils;
/**
diff --git a/src/main/java/com/prowidesoftware/swift/constraints/CurrencyConstraint.java b/src/main/java/com/prowidesoftware/swift/constraints/CurrencyConstraint.java
index 209906689..c035229d6 100644
--- a/src/main/java/com/prowidesoftware/swift/constraints/CurrencyConstraint.java
+++ b/src/main/java/com/prowidesoftware/swift/constraints/CurrencyConstraint.java
@@ -17,12 +17,12 @@
import static java.lang.annotation.ElementType.*;
+import jakarta.validation.Constraint;
+import jakarta.validation.Payload;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
-import javax.validation.Constraint;
-import javax.validation.Payload;
/**
* Bean validation for ISO currency codes.
diff --git a/src/main/java/com/prowidesoftware/swift/constraints/CurrencyValidator.java b/src/main/java/com/prowidesoftware/swift/constraints/CurrencyValidator.java
index fae441beb..ea2519b1c 100644
--- a/src/main/java/com/prowidesoftware/swift/constraints/CurrencyValidator.java
+++ b/src/main/java/com/prowidesoftware/swift/constraints/CurrencyValidator.java
@@ -16,8 +16,8 @@
package com.prowidesoftware.swift.constraints;
import com.prowidesoftware.swift.utils.IsoUtils;
-import javax.validation.ConstraintValidator;
-import javax.validation.ConstraintValidatorContext;
+import jakarta.validation.ConstraintValidator;
+import jakarta.validation.ConstraintValidatorContext;
import org.apache.commons.lang3.StringUtils;
/**
diff --git a/src/main/java/com/prowidesoftware/swift/constraints/IbanConstraint.java b/src/main/java/com/prowidesoftware/swift/constraints/IbanConstraint.java
index 4c3056f22..5bceb1efb 100644
--- a/src/main/java/com/prowidesoftware/swift/constraints/IbanConstraint.java
+++ b/src/main/java/com/prowidesoftware/swift/constraints/IbanConstraint.java
@@ -17,12 +17,12 @@
import static java.lang.annotation.ElementType.*;
+import jakarta.validation.Constraint;
+import jakarta.validation.Payload;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
-import javax.validation.Constraint;
-import javax.validation.Payload;
/**
* Bean validation for IBAN numbers.
diff --git a/src/main/java/com/prowidesoftware/swift/constraints/IbanValidator.java b/src/main/java/com/prowidesoftware/swift/constraints/IbanValidator.java
index 2eaf443aa..638ece08f 100644
--- a/src/main/java/com/prowidesoftware/swift/constraints/IbanValidator.java
+++ b/src/main/java/com/prowidesoftware/swift/constraints/IbanValidator.java
@@ -17,8 +17,8 @@
import com.prowidesoftware.swift.model.IBAN;
import com.prowidesoftware.swift.model.IbanValidationResult;
-import javax.validation.ConstraintValidator;
-import javax.validation.ConstraintValidatorContext;
+import jakarta.validation.ConstraintValidator;
+import jakarta.validation.ConstraintValidatorContext;
import org.apache.commons.lang3.StringUtils;
/**
diff --git a/src/main/java/com/prowidesoftware/swift/model/AbstractSwiftMessage.java b/src/main/java/com/prowidesoftware/swift/model/AbstractSwiftMessage.java
index 87cbd23dc..62b6e107d 100644
--- a/src/main/java/com/prowidesoftware/swift/model/AbstractSwiftMessage.java
+++ b/src/main/java/com/prowidesoftware/swift/model/AbstractSwiftMessage.java
@@ -21,6 +21,8 @@
import com.prowidesoftware.deprecation.ProwideDeprecated;
import com.prowidesoftware.deprecation.TargetYear;
import com.prowidesoftware.swift.utils.Lib;
+import jakarta.persistence.*;
+import jakarta.xml.bind.annotation.XmlTransient;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
@@ -28,8 +30,6 @@
import java.math.BigDecimal;
import java.text.NumberFormat;
import java.util.*;
-import javax.persistence.*;
-import javax.xml.bind.annotation.XmlTransient;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
diff --git a/src/main/java/com/prowidesoftware/swift/model/MtSwiftMessage.java b/src/main/java/com/prowidesoftware/swift/model/MtSwiftMessage.java
index 8f47fff03..e53cc1113 100644
--- a/src/main/java/com/prowidesoftware/swift/model/MtSwiftMessage.java
+++ b/src/main/java/com/prowidesoftware/swift/model/MtSwiftMessage.java
@@ -24,6 +24,9 @@
import com.prowidesoftware.swift.model.mt.AbstractMT;
import com.prowidesoftware.swift.model.mt.DefaultMtMetadataStrategy;
import com.prowidesoftware.swift.model.mt.MTVariant;
+import jakarta.persistence.Column;
+import jakarta.persistence.DiscriminatorValue;
+import jakarta.persistence.Entity;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
@@ -31,9 +34,6 @@
import java.util.Objects;
import java.util.Optional;
import java.util.logging.Level;
-import javax.persistence.Column;
-import javax.persistence.DiscriminatorValue;
-import javax.persistence.Entity;
import org.apache.commons.lang3.EnumUtils;
import org.apache.commons.lang3.StringUtils;
diff --git a/src/main/java/com/prowidesoftware/swift/model/SwiftMessageNote.java b/src/main/java/com/prowidesoftware/swift/model/SwiftMessageNote.java
index d077c23dc..c092a0a5f 100644
--- a/src/main/java/com/prowidesoftware/swift/model/SwiftMessageNote.java
+++ b/src/main/java/com/prowidesoftware/swift/model/SwiftMessageNote.java
@@ -15,8 +15,8 @@
*/
package com.prowidesoftware.swift.model;
+import jakarta.persistence.*;
import java.util.Calendar;
-import javax.persistence.*;
/**
* Comments associated to a message for application only usage (not part of the standard).
diff --git a/src/main/java/com/prowidesoftware/swift/model/SwiftMessageRevision.java b/src/main/java/com/prowidesoftware/swift/model/SwiftMessageRevision.java
index 9120051eb..855a6f90d 100644
--- a/src/main/java/com/prowidesoftware/swift/model/SwiftMessageRevision.java
+++ b/src/main/java/com/prowidesoftware/swift/model/SwiftMessageRevision.java
@@ -15,11 +15,11 @@
*/
package com.prowidesoftware.swift.model;
-import static javax.persistence.FetchType.LAZY;
+import static jakarta.persistence.FetchType.LAZY;
+import jakarta.persistence.*;
import java.util.Calendar;
import java.util.Objects;
-import javax.persistence.*;
/**
* A revision is a snapshot of message content and is used to track the history of changes in a message.
diff --git a/src/main/java/com/prowidesoftware/swift/model/SwiftMessageStatusInfo.java b/src/main/java/com/prowidesoftware/swift/model/SwiftMessageStatusInfo.java
index 5895b4b7a..c6dd7ee7b 100644
--- a/src/main/java/com/prowidesoftware/swift/model/SwiftMessageStatusInfo.java
+++ b/src/main/java/com/prowidesoftware/swift/model/SwiftMessageStatusInfo.java
@@ -15,11 +15,11 @@
*/
package com.prowidesoftware.swift.model;
-import static javax.persistence.FetchType.LAZY;
+import static jakarta.persistence.FetchType.LAZY;
+import jakarta.persistence.*;
import java.util.Calendar;
import java.util.Objects;
-import javax.persistence.*;
/**
* Status tracking record for application only usage (not part of the standard).
diff --git a/src/test/java/com/prowidesoftware/swift/constraints/IbanValidatorTest.java b/src/test/java/com/prowidesoftware/swift/constraints/IbanValidatorTest.java
index 861e51b31..76479631d 100644
--- a/src/test/java/com/prowidesoftware/swift/constraints/IbanValidatorTest.java
+++ b/src/test/java/com/prowidesoftware/swift/constraints/IbanValidatorTest.java
@@ -4,8 +4,8 @@
import com.prowidesoftware.swift.model.IBAN;
import com.prowidesoftware.swift.model.IbanValidationResult;
-import javax.validation.ClockProvider;
-import javax.validation.ConstraintValidatorContext;
+import jakarta.validation.ClockProvider;
+import jakarta.validation.ConstraintValidatorContext;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
diff --git a/src/test/java/com/prowidesoftware/swift/model/field/FieldComponentLabelsCompatibilityTest.java b/src/test/java/com/prowidesoftware/swift/model/field/FieldComponentLabelsCompatibilityTest.java
index 46b63c110..b5f106d87 100644
--- a/src/test/java/com/prowidesoftware/swift/model/field/FieldComponentLabelsCompatibilityTest.java
+++ b/src/test/java/com/prowidesoftware/swift/model/field/FieldComponentLabelsCompatibilityTest.java
@@ -59,8 +59,8 @@ public void test() throws Exception {
int missing = 0;
int availableOK = 0;
int availableError = 0;
- for (Class c : classes) {
- Field f = (Field) c.newInstance();
+ for (Class> c : classes) {
+ Field f = (Field) c.getDeclaredConstructor().newInstance();
int size = f.getComponents().size();
final String label = Field.getLabelComponents(f.getName(), null, null, null);
if (label.endsWith(".components")) {