From 0919ba3eea00eae7960db0c073e56395e04a3625 Mon Sep 17 00:00:00 2001 From: fxlae Date: Sat, 18 May 2024 13:36:28 +0200 Subject: [PATCH] release 0.2.1 backport to v0.2: fix bug for when the first suffix character exceeds 1 byte --- .github/workflows/build-on-push.yml | 10 ++++------ .github/workflows/publish-on-release.yml | 11 +++++------ README.md | 4 ++-- .../typeid/typeid.library-conventions.gradle.kts | 2 +- gradle/libs.versions.toml | 10 +++++----- lib/shared/build.gradle.kts | 2 +- .../src/main/java/de/fxlae/typeid/lib/TypeIdLib.java | 5 +++-- .../test/java/de/fxlae/typeid/AbstractTypeIdTest.java | 1 + 8 files changed, 22 insertions(+), 23 deletions(-) diff --git a/.github/workflows/build-on-push.yml b/.github/workflows/build-on-push.yml index 9abc0f8..86b423f 100644 --- a/.github/workflows/build-on-push.yml +++ b/.github/workflows/build-on-push.yml @@ -5,12 +5,10 @@ jobs: build-gradle-project: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-java@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 with: distribution: temurin java-version: 17 - - uses: gradle/gradle-build-action@v2.5.1 - with: - gradle-version: wrapper - arguments: build + - uses: gradle/actions/setup-gradle@v3 + - run: ./gradlew build diff --git a/.github/workflows/publish-on-release.yml b/.github/workflows/publish-on-release.yml index bc7caa3..0b38e2c 100644 --- a/.github/workflows/publish-on-release.yml +++ b/.github/workflows/publish-on-release.yml @@ -7,15 +7,14 @@ jobs: publish: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-java@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 with: distribution: temurin java-version: 17 - - uses: gradle/gradle-build-action@v2.5.1 - with: - gradle-version: wrapper - arguments: build publishAllPublicationsToOSSRHRepository + - uses: gradle/actions/setup-gradle@v3 + - run: ./gradlew build + - run: ./gradlew publishAllPublicationsToOSSRHRepository env: ORG_GRADLE_PROJECT_OSSRHUsername: ${{ secrets.OSSRH_USERNAME }} ORG_GRADLE_PROJECT_OSSRHPassword: ${{ secrets.OSSRH_TOKEN }} diff --git a/README.md b/README.md index 827970c..87045c9 100644 --- a/README.md +++ b/README.md @@ -22,14 +22,14 @@ To install via Maven: de.fxlae typeid-java - 0.2.0 + 0.2.1 ``` For installation via Gradle: ```kotlin -implementation("de.fxlae:typeid-java:0.2.0") // or ...typeid-java-jdk8:0.2.0 +implementation("de.fxlae:typeid-java:0.2.1") // or ...typeid-java-jdk8:0.2.1 ``` ## Usage diff --git a/build-conventions/src/main/kotlin/de/fxlae/typeid/typeid.library-conventions.gradle.kts b/build-conventions/src/main/kotlin/de/fxlae/typeid/typeid.library-conventions.gradle.kts index fe8de59..e8e15e2 100644 --- a/build-conventions/src/main/kotlin/de/fxlae/typeid/typeid.library-conventions.gradle.kts +++ b/build-conventions/src/main/kotlin/de/fxlae/typeid/typeid.library-conventions.gradle.kts @@ -6,7 +6,7 @@ plugins { } group = "de.fxlae" -version = "0.2.0" +version = "0.2.1" java { withJavadocJar() diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 82a6d04..a206674 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,10 +1,10 @@ [versions] -java-uuid-generator = "4.2.0" -jackson = "2.15.2" -junit = "5.9.1" -assertj = "3.24.2" +java-uuid-generator = "5.0.0" +jackson = "2.17.0" +junit = "5.10.2" +assertj = "3.25.3" shadow = "8.1.1" -jmh = "0.7.1" +jmh = "0.7.2" [plugins] jmh = { id = "me.champeau.jmh", version.ref = "jmh" } diff --git a/lib/shared/build.gradle.kts b/lib/shared/build.gradle.kts index 6019a6b..8b9e56b 100644 --- a/lib/shared/build.gradle.kts +++ b/lib/shared/build.gradle.kts @@ -20,5 +20,5 @@ artifacts { } dependencies { - implementation("com.fasterxml.uuid:java-uuid-generator:4.2.0") + implementation("com.fasterxml.uuid:java-uuid-generator:5.0.0") } diff --git a/lib/shared/src/main/java/de/fxlae/typeid/lib/TypeIdLib.java b/lib/shared/src/main/java/de/fxlae/typeid/lib/TypeIdLib.java index c7e85ec..7f554bd 100644 --- a/lib/shared/src/main/java/de/fxlae/typeid/lib/TypeIdLib.java +++ b/lib/shared/src/main/java/de/fxlae/typeid/lib/TypeIdLib.java @@ -35,7 +35,7 @@ public final class TypeIdLib { NOOP, NOOP, NOOP, NOOP, NOOP, NOOP, NOOP, NOOP, NOOP, NOOP, NOOP, NOOP, NOOP, NOOP, NOOP, NOOP, NOOP, 0x0A, 0x0B, 0x0C, // a, b, c 0x0D, 0x0E, 0x0F, 0x10, 0x11, NOOP, 0x12, 0x13, NOOP, 0x14, // d, e, f, g, h, j, k, m - 0x15, NOOP, 0x16, 0x17, 0x18, 0x19, 0x1A, NOOP, 0x1B, 0x1C, // n, p, q, r, s, value, v, w + 0x15, NOOP, 0x16, 0x17, 0x18, 0x19, 0x1A, NOOP, 0x1B, 0x1C, // n, p, q, r, s, t, v, w 0x1D, 0x1E, 0x1F, NOOP, NOOP, NOOP, NOOP, NOOP, NOOP, NOOP, // x, y, z NOOP, NOOP, NOOP, NOOP, NOOP, NOOP, NOOP, NOOP, NOOP, NOOP, NOOP, NOOP, NOOP, NOOP, NOOP, NOOP, NOOP, NOOP, NOOP, NOOP, @@ -191,7 +191,8 @@ private static String validateSuffixOnInput(final String input, final int separa return "Suffix with illegal length, must be " + SUFFIX_LENGTH; } - if (((SUFFIX_LOOKUP[input.charAt(start)] >>> 3) & 0x3) > 0) { + final char firstChar = input.charAt(start); + if (firstChar < '0' || firstChar > '7') { return "Illegal leftmost suffix character, must be one of [01234567]"; } diff --git a/lib/shared/src/test/java/de/fxlae/typeid/AbstractTypeIdTest.java b/lib/shared/src/test/java/de/fxlae/typeid/AbstractTypeIdTest.java index 8be5153..017cb1b 100644 --- a/lib/shared/src/test/java/de/fxlae/typeid/AbstractTypeIdTest.java +++ b/lib/shared/src/test/java/de/fxlae/typeid/AbstractTypeIdTest.java @@ -148,6 +148,7 @@ void parseWithValidInputsShouldReturnTypeId(String input) { "_01h455vb4pex5vsknk084sn02q", // suffix only, but with preceding underscore "sömeprefix_01h455vb4pex5vsknk084sn02q", // prefix with 'ö' "someprefix_01h455öb4pex5vsknk084sn02q", // suffix with 'ö' + "someprefix_Ă01h455b4pex5vsknk084sn02q", // suffix with 'Ă' (> ascii 255) as first char "sOmeprefix_01h455vb4pex5vsknk084sn02q", // prefix with 'O' "someprefix_01h455Vb4pex5vsknk084sn02q", // suffix with 'V' "someprefix_01h455lb4pex5vsknk084sn02q", // suffix with 'l'