From ec6e8ffa2a84a50726d60840fb2a9ba306c06716 Mon Sep 17 00:00:00 2001 From: Daniel DeGroff Date: Mon, 6 Dec 2021 19:03:58 -0700 Subject: [PATCH 01/14] Add data attributes, bump version. --- build.savant | 12 +++++++++--- pom.xml | 2 +- src/main/java/com/inversoft/error/Error.java | 13 ++++++------- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/build.savant b/build.savant index b351ffb..5e2e401 100644 --- a/build.savant +++ b/build.savant @@ -3,13 +3,19 @@ */ savantVersion = "1.0.0" -project(group: "com.inversoft", name: "java-error", version: "2.2.2", licenses: ["ApacheV2_0"]) { +project(group: "com.inversoft", name: "java-error", version: "2.2.3", licenses: ["ApacheV2_0"]) { workflow { - standard() + fetch { + cache() + url(url: "https://external.savant.fusionauth.io") + } + publish { + cache() + } } publishWorkflow { - subversion(repository: "http://svn.inversoft.org/savant") + subversion(repository: "https://external.svn.fusionauth.io") } dependencies { diff --git a/pom.xml b/pom.xml index 4da19d9..4bee216 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.inversoft java-error - 2.2.2 + 2.2.3 jar Inversoft Java Error diff --git a/src/main/java/com/inversoft/error/Error.java b/src/main/java/com/inversoft/error/Error.java index 1a2c9c2..c4ae8b6 100644 --- a/src/main/java/com/inversoft/error/Error.java +++ b/src/main/java/com/inversoft/error/Error.java @@ -16,6 +16,8 @@ package com.inversoft.error; import java.util.Arrays; +import java.util.Map; +import java.util.Objects; import com.fasterxml.jackson.annotation.JsonIgnore; import com.inversoft.json.JacksonConstructor; @@ -29,6 +31,8 @@ public class Error { public String code; + public Map data; + public String message; @JsonIgnore @@ -51,18 +55,13 @@ public Error(String code, String message, Object... values) { public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; - Error error = (Error) o; - - return code.equals(error.code) && - (message != null ? message.equals(error.message) : error.message == null) && - Arrays.equals(values, error.values); + return Objects.equals(code, error.code) && Objects.equals(data, error.data) && Objects.equals(message, error.message) && Arrays.equals(values, error.values); } @Override public int hashCode() { - int result = code.hashCode(); - result = 31 * result + (message != null ? message.hashCode() : 0); + int result = Objects.hash(code, data, message); result = 31 * result + Arrays.hashCode(values); return result; } From 2ca1c7957513674a169530717fff3b812adb0163 Mon Sep 17 00:00:00 2001 From: Daniel DeGroff Date: Mon, 6 Dec 2021 19:59:35 -0700 Subject: [PATCH 02/14] Add data attributes. --- src/main/java/com/inversoft/error/Error.java | 7 +++++ src/main/java/com/inversoft/error/Errors.java | 31 +++++++++++++------ 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/inversoft/error/Error.java b/src/main/java/com/inversoft/error/Error.java index c4ae8b6..63ffe09 100644 --- a/src/main/java/com/inversoft/error/Error.java +++ b/src/main/java/com/inversoft/error/Error.java @@ -45,6 +45,13 @@ public class Error { public Error() { } + public Error(String code, String message, Map data, Object... values) { + this.code = code; + this.data = data; + this.message = message; + this.values = values; + } + public Error(String code, String message, Object... values) { this.code = code; this.message = message; diff --git a/src/main/java/com/inversoft/error/Errors.java b/src/main/java/com/inversoft/error/Errors.java index 97bffb4..d5da627 100644 --- a/src/main/java/com/inversoft/error/Errors.java +++ b/src/main/java/com/inversoft/error/Errors.java @@ -46,18 +46,16 @@ public Errors add(Errors otherErrors) { return this; } - public Errors addFieldError(String field, String code, String message, Object... values) { - List errors = fieldErrors.get(field); - if (errors == null) { - errors = new LinkedList<>(); - fieldErrors.put(field, errors); - } - - errors.add(new Error(code, message, values)); - + public Errors addFieldError(String field, String code, String message, Map data, Object... values) { + List errors = fieldErrors.computeIfAbsent(field, k -> new LinkedList<>()); + errors.add(new Error(code, message, data, values)); return this; } + public Errors addFieldError(String field, String code, String message, Object... values) { + return addFieldError(field, code, message, null, values); + } + public Errors addGeneralError(String code, String message, Object... values) { generalErrors.add(new Error(code, message, values)); return this; @@ -105,6 +103,21 @@ public boolean equals(Object o) { return fieldErrors.equals(errors.fieldErrors) && generalErrors.equals(errors.generalErrors); } + public Error getFieldError(String field, String code) { + List errors = fieldErrors.get(field); + if (errors == null) { + return null; + } + + for (Error fieldError : errors) { + if (fieldError.code.equals(code)) { + return fieldError; + } + } + + return null; + } + @Override public int hashCode() { int result = generalErrors.hashCode(); From 0fd27ee7b67d3add63006d981b377c4eb7b4fd1d Mon Sep 17 00:00:00 2001 From: Daniel DeGroff Date: Mon, 6 Dec 2021 20:08:04 -0700 Subject: [PATCH 03/14] Update maven build plugin for javadoc. Fix JavaDoc. --- pom.xml | 2 +- src/main/java/com/inversoft/error/Errors.java | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 4bee216..a66512e 100644 --- a/pom.xml +++ b/pom.xml @@ -104,7 +104,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 2.9.1 + 3.2.0 attach-javadocs diff --git a/src/main/java/com/inversoft/error/Errors.java b/src/main/java/com/inversoft/error/Errors.java index d5da627..c7b04ca 100644 --- a/src/main/java/com/inversoft/error/Errors.java +++ b/src/main/java/com/inversoft/error/Errors.java @@ -67,6 +67,9 @@ public Errors addGeneralError(String code, String message, Object... values) { *

* This is a little loose, making the caller know which code prefixes the Validator is using, an enum or something * might work nicely... for now keeping this. + * + * @param codePrefix the code prefix. + * @return true if an error code with this prefix exists in general or field errors. */ public boolean containsError(String codePrefix) { for (Error error : generalErrors) { From 8d9b9f9fb64a21c03ba5b25553e8f1dcd4a130fb Mon Sep 17 00:00:00 2001 From: Daniel DeGroff Date: Mon, 6 Dec 2021 20:09:16 -0700 Subject: [PATCH 04/14] Add release profile. --- pom.xml | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/pom.xml b/pom.xml index a66512e..8d44a55 100644 --- a/pom.xml +++ b/pom.xml @@ -117,6 +117,45 @@ + + + release + + + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.6.8 + true + + ossrh + https://oss.sonatype.org/ + true + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.5 + + + sign-artifacts + verify + + sign + + + Inversoft + false + + + + + + + + + From b7602448341f26d8dc3addfeadd070fccde9e965 Mon Sep 17 00:00:00 2001 From: Daniel DeGroff Date: Fri, 10 Dec 2021 15:35:59 -0700 Subject: [PATCH 05/14] Update Savant / SVN URLs --- build.savant | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.savant b/build.savant index 5e2e401..79db641 100644 --- a/build.savant +++ b/build.savant @@ -7,7 +7,7 @@ project(group: "com.inversoft", name: "java-error", version: "2.2.3", licenses: workflow { fetch { cache() - url(url: "https://external.savant.fusionauth.io") + url(url: "https://repository.savantbuild.org") } publish { cache() @@ -15,7 +15,7 @@ project(group: "com.inversoft", name: "java-error", version: "2.2.3", licenses: } publishWorkflow { - subversion(repository: "https://external.svn.fusionauth.io") + subversion(repository: "https://svn.savantbuild.org") } dependencies { From e6541d23cc9922dcbbb969b4e9e186c60390986e Mon Sep 17 00:00:00 2001 From: Daniel DeGroff Date: Fri, 5 Aug 2022 13:16:42 -0600 Subject: [PATCH 06/14] Deps, IML --- build.savant | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.savant b/build.savant index 79db641..c5558c9 100644 --- a/build.savant +++ b/build.savant @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2019, Inversoft Inc., All Rights Reserved + * Copyright (c) 2015-2022, Inversoft Inc., All Rights Reserved */ savantVersion = "1.0.0" @@ -34,7 +34,7 @@ project(group: "com.inversoft", name: "java-error", version: "2.2.3", licenses: // Plugins dependency = loadPlugin(id: "org.savantbuild.plugin:dependency:1.0.2") file = loadPlugin(id: "org.savantbuild.plugin:file:1.0.2") -java = loadPlugin(id: "org.savantbuild.plugin:java:1.0.2") +java = loadPlugin(id: "org.savantbuild.plugin:java:1.2.0") idea = loadPlugin(id: "org.savantbuild.plugin:idea:1.0.1") release = loadPlugin(id: "org.savantbuild.plugin:release-git:${savantVersion}") From 5308d52c18949621a4d8049ac4d50f0e3f6a0a90 Mon Sep 17 00:00:00 2001 From: Daniel DeGroff Date: Wed, 12 Oct 2022 14:52:01 -0600 Subject: [PATCH 07/14] update pom.xml --- pom.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 8d44a55..357bfbd 100644 --- a/pom.xml +++ b/pom.xml @@ -91,7 +91,7 @@ org.apache.maven.plugins maven-source-plugin - 2.2.1 + 3.2.1 attach-sources @@ -104,7 +104,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.2.0 + 3.4.1 attach-javadocs @@ -125,7 +125,7 @@ org.sonatype.plugins nexus-staging-maven-plugin - 1.6.8 + 1.6.13 true ossrh @@ -145,7 +145,7 @@ sign - Inversoft + ${gpg.keyname} false From 73c8d7aca9498d51943a971072fcc8ae667ef014 Mon Sep 17 00:00:00 2001 From: Brian Pontarelli Date: Tue, 25 Oct 2022 17:07:45 -0600 Subject: [PATCH 08/14] New Savant version and dependency for the Version class --- build.savant | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/build.savant b/build.savant index c5558c9..98a5c7a 100644 --- a/build.savant +++ b/build.savant @@ -1,8 +1,6 @@ /* * Copyright (c) 2015-2022, Inversoft Inc., All Rights Reserved */ -savantVersion = "1.0.0" - project(group: "com.inversoft", name: "java-error", version: "2.2.3", licenses: ["ApacheV2_0"]) { workflow { fetch { @@ -32,11 +30,11 @@ project(group: "com.inversoft", name: "java-error", version: "2.2.3", licenses: } // Plugins -dependency = loadPlugin(id: "org.savantbuild.plugin:dependency:1.0.2") -file = loadPlugin(id: "org.savantbuild.plugin:file:1.0.2") -java = loadPlugin(id: "org.savantbuild.plugin:java:1.2.0") -idea = loadPlugin(id: "org.savantbuild.plugin:idea:1.0.1") -release = loadPlugin(id: "org.savantbuild.plugin:release-git:${savantVersion}") +dependency = loadPlugin(id: "org.savantbuild.plugin:dependency:2.0.0-RC.2") +file = loadPlugin(id: "org.savantbuild.plugin:file:2.0.0-RC.2") +java = loadPlugin(id: "org.savantbuild.plugin:java:2.0.0-RC.2") +idea = loadPlugin(id: "org.savantbuild.plugin:idea:2.0.0-RC.2") +release = loadPlugin(id: "org.savantbuild.plugin:release-git:2.0.0-RC.2") java.settings.javaVersion = "1.8" From c1402a0a8d294454131dcf94e0fa75faf9b04608 Mon Sep 17 00:00:00 2001 From: Daniel DeGroff Date: Thu, 25 May 2023 01:14:13 -0600 Subject: [PATCH 09/14] .gitignore for savant cache --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 4fca8ee..f1b884a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ build *.iws -target \ No newline at end of file +target +.savant/cache From b17615518d06d88df54fc6d40bc684e376002c6b Mon Sep 17 00:00:00 2001 From: Daniel DeGroff Date: Mon, 24 Jul 2023 23:41:03 -0600 Subject: [PATCH 10/14] bump deps IML --- build.savant | 12 +++++------ java-error.iml | 54 +++++++++++++++++++++++++------------------------- 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/build.savant b/build.savant index 98a5c7a..2746921 100644 --- a/build.savant +++ b/build.savant @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2022, Inversoft Inc., All Rights Reserved + * Copyright (c) 2015-2023, Inversoft Inc., All Rights Reserved */ project(group: "com.inversoft", name: "java-error", version: "2.2.3", licenses: ["ApacheV2_0"]) { workflow { @@ -30,11 +30,11 @@ project(group: "com.inversoft", name: "java-error", version: "2.2.3", licenses: } // Plugins -dependency = loadPlugin(id: "org.savantbuild.plugin:dependency:2.0.0-RC.2") -file = loadPlugin(id: "org.savantbuild.plugin:file:2.0.0-RC.2") -java = loadPlugin(id: "org.savantbuild.plugin:java:2.0.0-RC.2") -idea = loadPlugin(id: "org.savantbuild.plugin:idea:2.0.0-RC.2") -release = loadPlugin(id: "org.savantbuild.plugin:release-git:2.0.0-RC.2") +dependency = loadPlugin(id: "org.savantbuild.plugin:dependency:2.0.0-RC.6") +file = loadPlugin(id: "org.savantbuild.plugin:file:2.0.0-RC.6") +java = loadPlugin(id: "org.savantbuild.plugin:java:2.0.0-RC.6") +idea = loadPlugin(id: "org.savantbuild.plugin:idea:2.0.0-RC.7") +release = loadPlugin(id: "org.savantbuild.plugin:release-git:2.0.0-RC.6") java.settings.javaVersion = "1.8" diff --git a/java-error.iml b/java-error.iml index 60696f9..303cb27 100644 --- a/java-error.iml +++ b/java-error.iml @@ -13,128 +13,128 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -143,22 +143,22 @@ - + - + - + - + From bc2c9fb90450c91f09ebf3b432343c8603581ee5 Mon Sep 17 00:00:00 2001 From: Daniel DeGroff Date: Tue, 28 May 2024 14:19:17 -0600 Subject: [PATCH 11/14] update savant plugins --- build.savant | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.savant b/build.savant index 2746921..fdf8e76 100644 --- a/build.savant +++ b/build.savant @@ -30,8 +30,8 @@ project(group: "com.inversoft", name: "java-error", version: "2.2.3", licenses: } // Plugins -dependency = loadPlugin(id: "org.savantbuild.plugin:dependency:2.0.0-RC.6") -file = loadPlugin(id: "org.savantbuild.plugin:file:2.0.0-RC.6") +dependency = loadPlugin(id: "org.savantbuild.plugin:dependency:2.0.0-RC.7") +file = loadPlugin(id: "org.savantbuild.plugin:file:2.0.0-RC.7") java = loadPlugin(id: "org.savantbuild.plugin:java:2.0.0-RC.6") idea = loadPlugin(id: "org.savantbuild.plugin:idea:2.0.0-RC.7") release = loadPlugin(id: "org.savantbuild.plugin:release-git:2.0.0-RC.6") From 0f568af998c18aea91f5c12e206bc0eb28226544 Mon Sep 17 00:00:00 2001 From: Daniel DeGroff Date: Fri, 25 Oct 2024 21:25:43 -0600 Subject: [PATCH 12/14] Bump savant, and deps --- build.savant | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/build.savant b/build.savant index fdf8e76..d134f0b 100644 --- a/build.savant +++ b/build.savant @@ -30,11 +30,11 @@ project(group: "com.inversoft", name: "java-error", version: "2.2.3", licenses: } // Plugins -dependency = loadPlugin(id: "org.savantbuild.plugin:dependency:2.0.0-RC.7") -file = loadPlugin(id: "org.savantbuild.plugin:file:2.0.0-RC.7") -java = loadPlugin(id: "org.savantbuild.plugin:java:2.0.0-RC.6") -idea = loadPlugin(id: "org.savantbuild.plugin:idea:2.0.0-RC.7") -release = loadPlugin(id: "org.savantbuild.plugin:release-git:2.0.0-RC.6") +dependency = loadPlugin(id: "org.savantbuild.plugin:dependency:2.0.0") +file = loadPlugin(id: "org.savantbuild.plugin:file:2.0.0") +java = loadPlugin(id: "org.savantbuild.plugin:java:2.0.0") +idea = loadPlugin(id: "org.savantbuild.plugin:idea:2.0.0") +release = loadPlugin(id: "org.savantbuild.plugin:release-git:2.0.0") java.settings.javaVersion = "1.8" From a5de093e58a927ce02033dbc8f715a4ec2d55064 Mon Sep 17 00:00:00 2001 From: Daniel DeGroff Date: Mon, 21 Jul 2025 18:07:03 -0600 Subject: [PATCH 13/14] switch to new maven central publishing plugin. --- pom.xml | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/pom.xml b/pom.xml index 357bfbd..98f9e7c 100644 --- a/pom.xml +++ b/pom.xml @@ -1,4 +1,7 @@ + @@ -15,13 +18,16 @@ - ossrh - https://oss.sonatype.org/content/repositories/snapshots + Central Portal Snapshots + central-portal-snapshots + https://central.sonatype.com/repository/maven-snapshots/ + + true + + + false + - - ossrh - https://oss.sonatype.org/service/local/staging/deploy/maven2/ - @@ -41,8 +47,9 @@ - The Apache License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt + Apache-2.0 + https://www.apache.org/licenses/LICENSE-2.0 + repo @@ -83,7 +90,7 @@ sign - Inversoft + ${gpg.keyname} @@ -123,14 +130,13 @@ - org.sonatype.plugins - nexus-staging-maven-plugin - 1.6.13 + org.sonatype.central + central-publishing-maven-plugin + 0.8.0 true - ossrh - https://oss.sonatype.org/ - true + central + true From 0d0edc163f3f68c924c3201b8493711af76a81f5 Mon Sep 17 00:00:00 2001 From: Daniel DeGroff Date: Mon, 21 Jul 2025 18:09:31 -0600 Subject: [PATCH 14/14] use POM plugin to keep deps in sync --- build.savant | 9 +++++++-- pom.xml | 16 ++++++++-------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/build.savant b/build.savant index d134f0b..1b4565f 100644 --- a/build.savant +++ b/build.savant @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2023, Inversoft Inc., All Rights Reserved + * Copyright (c) 2015-2025, Inversoft Inc., All Rights Reserved */ project(group: "com.inversoft", name: "java-error", version: "2.2.3", licenses: ["ApacheV2_0"]) { workflow { @@ -35,6 +35,7 @@ file = loadPlugin(id: "org.savantbuild.plugin:file:2.0.0") java = loadPlugin(id: "org.savantbuild.plugin:java:2.0.0") idea = loadPlugin(id: "org.savantbuild.plugin:idea:2.0.0") release = loadPlugin(id: "org.savantbuild.plugin:release-git:2.0.0") +pom = loadPlugin(id: "org.savantbuild.plugin:pom:2.0.0") java.settings.javaVersion = "1.8" @@ -59,7 +60,7 @@ target(name: "doc", description: "Generate the project's JavaDoc", dependsOn: [" java.document() } -target(name: "int", description: "Releases a local integration build of the project", dependsOn: ["test"]) { +target(name: "int", description: "Releases a local integration build of the project", dependsOn: ["test", "pom"]) { dependency.integrate() } @@ -75,6 +76,10 @@ target(name: "idea", description: "Updates the IntelliJ IDEA module file") { idea.iml() } +target(name: "pom", description: "Updates the pom.xml file") { + pom.update() +} + target(name: "publish", description: "Publish to MVN repo", dependsOn: ["clean", "test"]) { if (new ProcessBuilder('mvn', 'deploy', '-Prelease').inheritIO().start().waitFor() != 0) { fail("deploy failed") diff --git a/pom.xml b/pom.xml index 98f9e7c..001a12d 100644 --- a/pom.xml +++ b/pom.xml @@ -1,10 +1,6 @@ - - + --> 4.0.0 com.inversoft @@ -68,11 +64,17 @@ com.fasterxml.jackson.core jackson-annotations 2.10.1 + jar + compile + false com.inversoft jackson5 2.4.4 + jar + compile + false @@ -162,6 +164,4 @@ - - - + \ No newline at end of file