diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 2117c22..047cde8 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -19,7 +19,7 @@ on: - master env: - JAVA_VERSION: '17.0.8+7' + JAVA_VERSION: '21.0.3+9.0.LTS' JAVA_DISTRIBUTION: 'temurin' jobs: diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index a46985f..a16527d 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -19,7 +19,7 @@ on: - master env: - JAVA_VERSION: '17.0.8+7' + JAVA_VERSION: '21.0.3+9.0.LTS' JAVA_DISTRIBUTION: 'temurin' TEST_SCREEN_WIDTH: '1920' TEST_SCREEN_HEIGHT: '1080' diff --git a/build.gradle b/build.gradle index 356fc50..19e3b06 100644 --- a/build.gradle +++ b/build.gradle @@ -19,15 +19,16 @@ plugins { id 'application' id 'org.openjfx.javafxplugin' version '0.1.0' - id 'org.javamodularity.moduleplugin' version '1.8.12' - id 'com.github.ben-manes.versions' version '0.49.0' + id 'org.javamodularity.moduleplugin' version '1.8.15' + id 'com.github.ben-manes.versions' version '0.51.0' id 'org.beryx.jlink' version '3.0.1' id 'jacoco' - id 'net.ltgt.errorprone' version '3.1.0' - id 'org.sonarqube' version '4.4.1.3373' + id 'net.ltgt.errorprone' version '4.0.1' + id 'org.sonarqube' version '5.1.0.4882' id 'org.ysb33r.cloudci' version '4.0.0' id 'com.github.hierynomus.license' version '0.16.1' id 'io.miret.etienne.sass' version '1.5.0' + id "com.ryandens.javaagent-test" version "0.5.1" } group 'com.github.mfl28' @@ -39,15 +40,16 @@ repositories { dependencies { // Junit (Unit testing) - testImplementation 'org.junit.jupiter:junit-jupiter:5.10.0' + testImplementation 'org.junit.jupiter:junit-jupiter:5.10.3' + testRuntimeOnly 'org.junit.platform:junit-platform-launcher' // TestFx UI TesTing // https://mvnrepository.com/artifact/org.testfx/testfx-junit5 - testImplementation('org.testfx:testfx-junit5:4.0.17') { + testImplementation('org.testfx:testfx-junit5:4.0.18') { exclude group: 'org.hamcrest' } // https://mvnrepository.com/artifact/nl.jqno.equalsverifier/equalsverifier - testImplementation 'nl.jqno.equalsverifier:equalsverifier:3.15.2' + testImplementation 'nl.jqno.equalsverifier:equalsverifier:3.16.1' // Hamcrest https://mvnrepository.com/artifact/org.hamcrest/hamcrest testImplementation 'org.hamcrest:hamcrest:2.2' @@ -56,21 +58,23 @@ dependencies { testImplementation 'org.mockito:mockito-inline:5.2.0' // Mockito-Junit https://mvnrepository.com/artifact/org.mockito/mockito-junit-jupiter - testImplementation 'org.mockito:mockito-junit-jupiter:5.6.0' + testImplementation 'org.mockito:mockito-junit-jupiter:5.12.0' testImplementation 'com.google.jimfs:jimfs:1.3.0' + testJavaagent "net.bytebuddy:byte-buddy-agent:1.14.18" + // Commons Collections https://mvnrepository.com/artifact/org.apache.commons/commons-collections4 implementation 'org.apache.commons:commons-collections4:4.4' // Commons Lang https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 - implementation 'org.apache.commons:commons-lang3:3.13.0' + implementation 'org.apache.commons:commons-lang3:3.14.0' // https://mvnrepository.com/artifact/commons-io/commons-io - implementation 'commons-io:commons-io:2.15.0' + implementation 'commons-io:commons-io:2.16.1' // ControlsFX https://mvnrepository.com/artifact/org.controlsfx/controlsfx - implementation('org.controlsfx:controlsfx:11.1.2') { + implementation('org.controlsfx:controlsfx:11.2.1') { exclude group: 'org.openjfx' } @@ -78,43 +82,43 @@ dependencies { implementation 'com.github.ben-manes.caffeine:caffeine:3.1.8' // Gradle plugin to use the error-prone compiler https://github.com/tbroyer/gradle-errorprone-plugin - errorprone 'com.google.errorprone:error_prone_core:2.23.0' + errorprone 'com.google.errorprone:error_prone_core:2.28.0' // Google GSON https://github.com/google/gson - implementation 'com.google.code.gson:gson:2.10.1' + implementation 'com.google.code.gson:gson:2.11.0' // Jersey REST client https://mvnrepository.com/artifact/org.glassfish.jersey.core/jersey-client - implementation 'org.glassfish.jersey.core:jersey-client:3.1.3' + implementation 'org.glassfish.jersey.core:jersey-client:3.1.7' // HK2 InjectionManager https://mvnrepository.com/artifact/org.glassfish.jersey.inject/jersey-hk2 - implementation 'org.glassfish.jersey.inject:jersey-hk2:3.1.3' + implementation 'org.glassfish.jersey.inject:jersey-hk2:3.1.7' // Jersey Multipart https://mvnrepository.com/artifact/org.glassfish.jersey.media/jersey-media-multipart - implementation 'org.glassfish.jersey.media:jersey-media-multipart:3.1.3' + implementation 'org.glassfish.jersey.media:jersey-media-multipart:3.1.7' // Jaxb runtime https://mvnrepository.com/artifact/org.glassfish.jaxb/jaxb-runtime - implementation 'org.glassfish.jaxb:jaxb-runtime:4.0.4' + implementation 'org.glassfish.jaxb:jaxb-runtime:4.0.5' // Mimepull https://mvnrepository.com/artifact/org.jvnet.mimepull/mimepull implementation 'org.jvnet.mimepull:mimepull:1.10.0' // Xml bind https://mvnrepository.com/artifact/jakarta.xml.bind/jakarta.xml.bind-api - implementation 'jakarta.xml.bind:jakarta.xml.bind-api:4.0.1' + implementation 'jakarta.xml.bind:jakarta.xml.bind-api:4.0.2' // https://mvnrepository.com/artifact/jakarta.ws.rs/jakarta.ws.rs-api - implementation 'jakarta.ws.rs:jakarta.ws.rs-api:3.1.0' + implementation 'jakarta.ws.rs:jakarta.ws.rs-api:4.0.0' // https://mvnrepository.com/artifact/org.locationtech.jts/jts-core implementation 'org.locationtech.jts:jts-core:1.19.0' // https://mvnrepository.com/artifact/com.drewnoakes/metadata-extractor - implementation 'com.drewnoakes:metadata-extractor:2.18.0' + implementation 'com.drewnoakes:metadata-extractor:2.19.0' implementation 'com.opencsv:opencsv:5.9' } javafx { - version = '21.0.1' + version = '22.0.1' modules = ['javafx.base', 'javafx.graphics', 'javafx.controls', 'javafx.swing'] } @@ -168,7 +172,7 @@ tasks.named("dependencyUpdates").configure { } compileSass { - outputDir = project.file ("${buildDir}/resources/main/stylesheets/css") + outputDir = layout.buildDirectory.file ("resources/main/stylesheets/css").get().asFile destPath = "." sourceDir = project.file ("${projectDir}/src/main/resources/stylesheets/scss") style = expanded @@ -199,12 +203,12 @@ application { java { modularity.inferModulePath = false toolchain { - languageVersion.set(JavaLanguageVersion.of(17)) + languageVersion.set(JavaLanguageVersion.of(21)) } } jlink { - options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages'] + options = ['--strip-debug', '--compress', 'zip-6', '--no-header-files', '--no-man-pages'] launcher { name = 'BoundingBoxEditor' jvmArgs = ['-Dprism.forceGPU=true', '-Djava.net.preferIPv6Addresses=system'] @@ -218,7 +222,7 @@ jlink { uses 'jakarta.ws.rs.ext.RuntimeDelegate' } - imageZip = project.file("${buildDir}/distributions/boundingboxeditor-${javafx.platform.classifier}.zip") + imageZip = layout.buildDirectory.file("distributions/boundingboxeditor-${javafx.platform.classifier}.zip") jpackage { installerOptions += [ @@ -258,7 +262,7 @@ jlink { } } -task dist { +tasks.register('dist') { dependsOn clean, jlinkZip } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index ccebba7..e644113 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 744c64d..09523c0 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 79a61d4..1aa94a4 100755 --- a/gradlew +++ b/gradlew @@ -83,10 +83,8 @@ done # This is normally unused # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -133,10 +131,13 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. @@ -144,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -152,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -197,11 +198,15 @@ if "$cygwin" || "$msys" ; then done fi -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ diff --git a/gradlew.bat b/gradlew.bat index 6689b85..7101f8e 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -43,11 +43,11 @@ set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail diff --git a/src/main/java/com/github/mfl28/boundingboxeditor/model/data/ImageMetaData.java b/src/main/java/com/github/mfl28/boundingboxeditor/model/data/ImageMetaData.java index d209c31..b491ca2 100644 --- a/src/main/java/com/github/mfl28/boundingboxeditor/model/data/ImageMetaData.java +++ b/src/main/java/com/github/mfl28/boundingboxeditor/model/data/ImageMetaData.java @@ -33,6 +33,7 @@ import java.io.Serial; import java.util.Iterator; import java.util.List; +import java.util.Locale; import java.util.Objects; /** @@ -195,7 +196,7 @@ private static ImageDimensions readImageDimensionsFromFile(File imageFile) throw try { reader.setInput(imageStream); - final String imageFormatName = reader.getFormatName().toLowerCase(); + final String imageFormatName = reader.getFormatName().toLowerCase(Locale.ENGLISH); if(!supportedImageFormats.contains(imageFormatName)) { throw new UnsupportedImageFileException(UNSUPPORTED_IMAGE_FORMAT_ERROR_MESSAGE); diff --git a/src/main/java/com/github/mfl28/boundingboxeditor/model/io/PVOCLoadStrategy.java b/src/main/java/com/github/mfl28/boundingboxeditor/model/io/PVOCLoadStrategy.java index 43b67ab..20be650 100644 --- a/src/main/java/com/github/mfl28/boundingboxeditor/model/io/PVOCLoadStrategy.java +++ b/src/main/java/com/github/mfl28/boundingboxeditor/model/io/PVOCLoadStrategy.java @@ -256,7 +256,7 @@ private void parseBoundingShapeDataTag(Element tagElement, BoundingShapeDataPars String poseValue = tagElement.getTextContent(); if(poseValue != null && !poseValue.equalsIgnoreCase("unspecified")) { - boxDataParseResult.getTags().add("pose: " + poseValue.toLowerCase()); + boxDataParseResult.getTags().add("pose: " + poseValue.toLowerCase(Locale.ENGLISH)); } break; @@ -458,18 +458,10 @@ public List getTags() { return tags; } - public void setTags(List tags) { - this.tags = tags; - } - public List getParts() { return parts; } - public void setParts(List parts) { - this.parts = parts; - } - public List getPoints() { return points; } diff --git a/src/main/java/com/github/mfl28/boundingboxeditor/model/io/PVOCSaveStrategy.java b/src/main/java/com/github/mfl28/boundingboxeditor/model/io/PVOCSaveStrategy.java index da7465e..3739ec1 100644 --- a/src/main/java/com/github/mfl28/boundingboxeditor/model/io/PVOCSaveStrategy.java +++ b/src/main/java/com/github/mfl28/boundingboxeditor/model/io/PVOCSaveStrategy.java @@ -177,7 +177,7 @@ private Element createXmlElementFromBoundingShapeData(final Document document, S List actionTags = new ArrayList<>(); for(String tag : boundingShapeData.getTags()) { - String lowerCaseTag = tag.toLowerCase(); + String lowerCaseTag = tag.toLowerCase(Locale.ENGLISH); if(lowerCaseTag.startsWith("pose:")) { poseString = StringUtils.capitalize(lowerCaseTag.substring(5).stripLeading()); diff --git a/src/main/java/com/github/mfl28/boundingboxeditor/utils/ColorUtils.java b/src/main/java/com/github/mfl28/boundingboxeditor/utils/ColorUtils.java index 8ac087a..f0f90da 100644 --- a/src/main/java/com/github/mfl28/boundingboxeditor/utils/ColorUtils.java +++ b/src/main/java/com/github/mfl28/boundingboxeditor/utils/ColorUtils.java @@ -20,6 +20,7 @@ import javafx.scene.paint.Color; +import java.util.Locale; import java.util.Random; /*** @@ -49,7 +50,7 @@ public static Color createRandomColor() { */ public static String colorToHexString(Color color) { return "#" + (format(color.getRed()) + format(color.getGreen()) + format(color.getBlue())) - .toUpperCase(); + .toUpperCase(Locale.ENGLISH); } /**