diff --git a/build.gradle b/build.gradle index a24d60970..9232f185c 100644 --- a/build.gradle +++ b/build.gradle @@ -55,11 +55,11 @@ 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' + 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.persistence:javax.persistence-api:2.2' + testImplementation 'jakarta.persistence:jakarta.persistence-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' diff --git a/src/main/java/com/prowidesoftware/swift/constraints/BicConstraint.java b/src/main/java/com/prowidesoftware/swift/constraints/BicConstraint.java index 1509d0967..48af08a76 100644 --- a/src/main/java/com/prowidesoftware/swift/constraints/BicConstraint.java +++ b/src/main/java/com/prowidesoftware/swift/constraints/BicConstraint.java @@ -17,14 +17,14 @@ 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 f3b8f2d26..8f5be99c4 100644 --- a/src/main/java/com/prowidesoftware/swift/constraints/BicValidator.java +++ b/src/main/java/com/prowidesoftware/swift/constraints/BicValidator.java @@ -17,11 +17,10 @@ import com.prowidesoftware.swift.model.BIC; import com.prowidesoftware.swift.model.BicValidationResult; +import jakarta.validation.ConstraintValidator; +import jakarta.validation.ConstraintValidatorContext; import org.apache.commons.lang3.StringUtils; -import javax.validation.ConstraintValidator; -import javax.validation.ConstraintValidatorContext; - /** * Implementation of the BIC validation constraint * diff --git a/src/main/java/com/prowidesoftware/swift/constraints/CountryConstraint.java b/src/main/java/com/prowidesoftware/swift/constraints/CountryConstraint.java index 965109e75..5b73fcd65 100644 --- a/src/main/java/com/prowidesoftware/swift/constraints/CountryConstraint.java +++ b/src/main/java/com/prowidesoftware/swift/constraints/CountryConstraint.java @@ -17,14 +17,14 @@ 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 9f027f0b9..1ee1df146 100644 --- a/src/main/java/com/prowidesoftware/swift/constraints/CountryValidator.java +++ b/src/main/java/com/prowidesoftware/swift/constraints/CountryValidator.java @@ -16,11 +16,10 @@ package com.prowidesoftware.swift.constraints; import com.prowidesoftware.swift.utils.IsoUtils; +import jakarta.validation.ConstraintValidator; +import jakarta.validation.ConstraintValidatorContext; import org.apache.commons.lang3.StringUtils; -import javax.validation.ConstraintValidator; -import javax.validation.ConstraintValidatorContext; - /** * Implementation of the ISO Alpha-2 country validation constraint * diff --git a/src/main/java/com/prowidesoftware/swift/constraints/CurrencyConstraint.java b/src/main/java/com/prowidesoftware/swift/constraints/CurrencyConstraint.java index 1fe3ac558..a208274c3 100644 --- a/src/main/java/com/prowidesoftware/swift/constraints/CurrencyConstraint.java +++ b/src/main/java/com/prowidesoftware/swift/constraints/CurrencyConstraint.java @@ -17,14 +17,14 @@ 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 a47cdcec2..00716a07b 100644 --- a/src/main/java/com/prowidesoftware/swift/constraints/CurrencyValidator.java +++ b/src/main/java/com/prowidesoftware/swift/constraints/CurrencyValidator.java @@ -16,11 +16,10 @@ package com.prowidesoftware.swift.constraints; import com.prowidesoftware.swift.utils.IsoUtils; +import jakarta.validation.ConstraintValidator; +import jakarta.validation.ConstraintValidatorContext; import org.apache.commons.lang3.StringUtils; -import javax.validation.ConstraintValidator; -import javax.validation.ConstraintValidatorContext; - /** * Implementation of the ISO currency code validation constraint * diff --git a/src/main/java/com/prowidesoftware/swift/constraints/IbanConstraint.java b/src/main/java/com/prowidesoftware/swift/constraints/IbanConstraint.java index 832380580..4249b8a52 100644 --- a/src/main/java/com/prowidesoftware/swift/constraints/IbanConstraint.java +++ b/src/main/java/com/prowidesoftware/swift/constraints/IbanConstraint.java @@ -17,14 +17,14 @@ 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 8c1d35f26..9421570c6 100644 --- a/src/main/java/com/prowidesoftware/swift/constraints/IbanValidator.java +++ b/src/main/java/com/prowidesoftware/swift/constraints/IbanValidator.java @@ -17,11 +17,10 @@ import com.prowidesoftware.swift.model.IBAN; import com.prowidesoftware.swift.model.IbanValidationResult; +import jakarta.validation.ConstraintValidator; +import jakarta.validation.ConstraintValidatorContext; import org.apache.commons.lang3.StringUtils; -import javax.validation.ConstraintValidator; -import javax.validation.ConstraintValidatorContext; - /** * Implementation of the IBAN validation constraint * diff --git a/src/main/java/com/prowidesoftware/swift/model/AbstractSwiftMessage.java b/src/main/java/com/prowidesoftware/swift/model/AbstractSwiftMessage.java index 571f7dca7..a1d817cb9 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 org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.Validate; @@ -33,9 +35,6 @@ import java.text.NumberFormat; import java.util.*; -import javax.persistence.*; -import javax.xml.bind.annotation.XmlTransient; - /** * Base entity for MT and MX message persistence. * diff --git a/src/main/java/com/prowidesoftware/swift/model/MtSwiftMessage.java b/src/main/java/com/prowidesoftware/swift/model/MtSwiftMessage.java index 8dddc1df9..6bfb332dd 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 org.apache.commons.lang3.EnumUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.Validate; @@ -36,10 +39,6 @@ import java.util.Optional; import java.util.logging.Level; -import javax.persistence.Column; -import javax.persistence.DiscriminatorValue; -import javax.persistence.Entity; - /** * MT messages entity for JPA persistence. diff --git a/src/main/java/com/prowidesoftware/swift/model/SwiftMessageNote.java b/src/main/java/com/prowidesoftware/swift/model/SwiftMessageNote.java index e61247cc2..becb700ae 100644 --- a/src/main/java/com/prowidesoftware/swift/model/SwiftMessageNote.java +++ b/src/main/java/com/prowidesoftware/swift/model/SwiftMessageNote.java @@ -15,9 +15,9 @@ */ package com.prowidesoftware.swift.model; -import java.util.Calendar; +import jakarta.persistence.*; -import javax.persistence.*; +import java.util.Calendar; /** * 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 5bea1ad3a..e34214528 100644 --- a/src/main/java/com/prowidesoftware/swift/model/SwiftMessageRevision.java +++ b/src/main/java/com/prowidesoftware/swift/model/SwiftMessageRevision.java @@ -15,13 +15,13 @@ */ 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. * Applications may use to store revisions each time a message is edited. diff --git a/src/main/java/com/prowidesoftware/swift/model/SwiftMessageStatusInfo.java b/src/main/java/com/prowidesoftware/swift/model/SwiftMessageStatusInfo.java index 7ae5877bc..c9b2bd2c0 100644 --- a/src/main/java/com/prowidesoftware/swift/model/SwiftMessageStatusInfo.java +++ b/src/main/java/com/prowidesoftware/swift/model/SwiftMessageStatusInfo.java @@ -15,13 +15,13 @@ */ 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).
* The status name identifier is modeled with plain String, nevertheless diff --git a/src/test/java/com/prowidesoftware/swift/io/parser/SwiftParserConsumeBlockLenientTest.java b/src/test/java/com/prowidesoftware/swift/io/parser/SwiftParserConsumeBlockLenientTest.java index 10a893e9c..48e6b64ef 100644 --- a/src/test/java/com/prowidesoftware/swift/io/parser/SwiftParserConsumeBlockLenientTest.java +++ b/src/test/java/com/prowidesoftware/swift/io/parser/SwiftParserConsumeBlockLenientTest.java @@ -319,7 +319,7 @@ public void testSimpleBlockConsumerBlock3_3_KnownToFail() throws IOException { assertEquals("00112233", b.getTagValue("108")); assertTrue(b.containsTag("4")); assertEquals("foobar", b.getTagValue("4")); - assertEquals(b.getUnparsedTextsSize(), new Integer(1)); + assertEquals(b.getUnparsedTextsSize(), Integer.valueOf(1)); assertEquals(b.unparsedTextGetText(0), "blockdata"); } diff --git a/src/test/java/com/prowidesoftware/swift/model/UnparsedTextListTest.java b/src/test/java/com/prowidesoftware/swift/model/UnparsedTextListTest.java index ebd5fcc14..8e77d065e 100644 --- a/src/test/java/com/prowidesoftware/swift/model/UnparsedTextListTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/UnparsedTextListTest.java @@ -58,7 +58,7 @@ public void test_staticIsMessage() { @Test public void test_addText() { t.addText(someText); - assertEquals(t.size(), new Integer(1)); + assertEquals(t.size(), Integer.valueOf(1)); assertEquals(t.getText(0), someText); } @@ -72,9 +72,9 @@ public void test_isMessage() { @Test public void test_size() { - assertEquals(t.size(), new Integer(0)); + assertEquals(t.size(), Integer.valueOf(0)); t.addText(someText); - assertEquals(t.size(), new Integer(1)); + assertEquals(t.size(), Integer.valueOf(1)); } @Test @@ -113,7 +113,7 @@ public void test_addTextMessage() { t.addText(msg); // check things out - assertEquals(t.size(), new Integer(1)); + assertEquals(t.size(), Integer.valueOf(1)); assertEquals(t.getText(0), msgString); } @@ -123,7 +123,7 @@ public void test_removeIndexOK() { t.addText(someMsg); t.removeText(0); assertEquals(t.getText(0), someMsg); - assertEquals(t.size(), new Integer(1)); + assertEquals(t.size(), Integer.valueOf(1)); } @Test @@ -137,7 +137,7 @@ public void test_removeText() { t.addText(someMsg); t.removeText(someText); assertEquals(t.getText(0), someMsg); - assertEquals(t.size(), new Integer(1)); + assertEquals(t.size(), Integer.valueOf(1)); } @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 5403150d8..68f55b095 100644 --- a/src/test/java/com/prowidesoftware/swift/model/field/FieldComponentLabelsCompatibilityTest.java +++ b/src/test/java/com/prowidesoftware/swift/model/field/FieldComponentLabelsCompatibilityTest.java @@ -51,8 +51,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")) { diff --git a/src/test/java/com/prowidesoftware/swift/utils/SwiftFormatUtilsTest.java b/src/test/java/com/prowidesoftware/swift/utils/SwiftFormatUtilsTest.java index f38adc5a0..892e21720 100644 --- a/src/test/java/com/prowidesoftware/swift/utils/SwiftFormatUtilsTest.java +++ b/src/test/java/com/prowidesoftware/swift/utils/SwiftFormatUtilsTest.java @@ -42,22 +42,22 @@ public void testGetNumber() { //this test does not work but this format is not used assertNotNull(SwiftFormatUtils.getNumber("1,2")); - assertEquals(new Double(1.2), new Double(SwiftFormatUtils.getNumber("1,2").doubleValue())); + assertEquals(Double.valueOf(1.2), Double.valueOf(SwiftFormatUtils.getNumber("1,2").doubleValue())); assertNotNull(SwiftFormatUtils.getNumber("12,34")); - assertEquals(new Double(12.34), new Double(SwiftFormatUtils.getNumber("12,34").doubleValue())); + assertEquals(Double.valueOf(12.34), Double.valueOf(SwiftFormatUtils.getNumber("12,34").doubleValue())); assertNotNull(SwiftFormatUtils.getNumber("12,3456")); - assertEquals(new Double(12.3456), new Double(SwiftFormatUtils.getNumber("12,3456").doubleValue())); + assertEquals(Double.valueOf(12.3456), Double.valueOf(SwiftFormatUtils.getNumber("12,3456").doubleValue())); assertNotNull(SwiftFormatUtils.getNumber("0,")); - assertEquals(new Double(0), new Double(SwiftFormatUtils.getNumber("0,").doubleValue())); + assertEquals(Double.valueOf(0), Double.valueOf(SwiftFormatUtils.getNumber("0,").doubleValue())); assertNotNull(SwiftFormatUtils.getNumber("299000,34")); - assertEquals(new Double(299000.34), new Double(SwiftFormatUtils.getNumber("299000,34").doubleValue())); + assertEquals(Double.valueOf(299000.34), Double.valueOf(SwiftFormatUtils.getNumber("299000,34").doubleValue())); assertNotNull(SwiftFormatUtils.getNumber(",34")); - assertEquals(new Double(0.34), new Double(SwiftFormatUtils.getNumber(",34").doubleValue())); + assertEquals(Double.valueOf(0.34), Double.valueOf(SwiftFormatUtils.getNumber(",34").doubleValue())); } @Test