diff --git a/build.gradle b/build.gradle index 17229a6..892225e 100644 --- a/build.gradle +++ b/build.gradle @@ -6,11 +6,10 @@ plugins { id 'java-library' id 'checkstyle' id 'jacoco' - id "com.github.spotbugs" version '6.1.11' + id "com.github.spotbugs" version '6.5.6' id 'com.adarshr.test-logger' version '4.0.0' - id "com.github.ben-manes.versions" version '0.52.0' - id 'org.sonatype.gradle.plugins.scan' version '3.1.1' - id "org.sonarqube" version '6.1.0.5360' + id "com.github.ben-manes.versions" version '0.54.0' + id "org.sonarqube" version '7.3.1.8318' id 'com.vanniktech.maven.publish' version '0.31.0' } @@ -41,7 +40,7 @@ dependencies { testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine' testRuntimeOnly 'org.junit.platform:junit-platform-launcher:1.12.2' - testImplementation 'commons-io:commons-io:2.19.0' + testImplementation 'commons-io:commons-io:2.22.0' testImplementation 'org.jsoup:jsoup:1.20.1' testImplementation 'com.jayway.jsonpath:json-path:2.9.0' } @@ -81,13 +80,6 @@ jacocoTestReport { } test.finalizedBy jacocoTestReport -// Nexus vulnerability scan (https://github.com/sonatype-nexus-community/scan-gradle-plugin) -ossIndexAudit { - outputFormat = 'DEPENDENCY_GRAPH' - printBanner = false -} -check.dependsOn 'ossIndexAudit' - sonar { properties { property "sonar.projectKey", "imsweb_x12-parser" @@ -159,6 +151,6 @@ mavenPublishing { } wrapper { - gradleVersion = '8.14' + gradleVersion = '9.5.1' distributionType = Wrapper.DistributionType.ALL } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 1b33c55..b1b8ef5 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 6514f91..e74c870 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,9 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.1-all.zip networkTimeout=10000 +retries=0 +retryBackOffMs=500 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 23d15a9..b9bb139 100755 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright © 2015-2021 the original authors. +# Copyright © 2015 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -57,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/3d91ce3b8caaf77ad09f381f43615b715b53f72c/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -114,7 +114,6 @@ case "$( uname )" in #( NONSTOP* ) nonstop=true ;; esac -CLASSPATH="\\\"\\\"" # Determine the Java command to use to start the JVM. @@ -172,7 +171,6 @@ fi # For Cygwin or MSYS, switch paths to Windows format before running java if "$cygwin" || "$msys" ; then APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) JAVACMD=$( cygpath --unix "$JAVACMD" ) @@ -212,7 +210,6 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ "$@" diff --git a/gradlew.bat b/gradlew.bat index db3a6ac..24c62d5 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -23,8 +23,8 @@ @rem @rem ########################################################################## -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal +@rem Set local scope for the variables, and ensure extensions are enabled +setlocal EnableExtensions set DIRNAME=%~dp0 if "%DIRNAME%"=="" set DIRNAME=. @@ -51,7 +51,7 @@ 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 +"%COMSPEC%" /c exit 1 :findJavaFromJavaHome set JAVA_HOME=%JAVA_HOME:"=% @@ -65,30 +65,18 @@ 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 +"%COMSPEC%" /c exit 1 :execute @rem Setup the command line -set CLASSPATH= @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* +@rem endlocal doesn't take effect until after the line is parsed and variables are expanded +@rem which allows us to clear the local environment before executing the java command +endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel -:end -@rem End local scope for the variables with windows NT shell -if %ERRORLEVEL% equ 0 goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -set EXIT_CODE=%ERRORLEVEL% -if %EXIT_CODE% equ 0 set EXIT_CODE=1 -if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% -exit /b %EXIT_CODE% - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +:exitWithErrorLevel +@rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts +"%COMSPEC%" /c exit %ERRORLEVEL% diff --git a/src/main/java/com/imsweb/x12/reader/X12Reader.java b/src/main/java/com/imsweb/x12/reader/X12Reader.java index 48c1f6d..2d38a2e 100644 --- a/src/main/java/com/imsweb/x12/reader/X12Reader.java +++ b/src/main/java/com/imsweb/x12/reader/X12Reader.java @@ -95,18 +95,19 @@ public enum FileType { * Load definition from file * @return a TransactionDefinition */ - public synchronized TransactionDefinition getDefinition() { - return _DEFINITIONS.computeIfAbsent(_mapping, k -> { - XStream xstream = new XStream(new StaxDriver()); - xstream.autodetectAnnotations(true); - xstream.alias("transaction", TransactionDefinition.class); - - // setup proper security by limiting what classes can be loaded by XStream - xstream.addPermission(NoTypePermission.NONE); - xstream.addPermission(new WildcardTypePermission(new String[] {"com.imsweb.x12.**"})); - - return (TransactionDefinition)xstream.fromXML(Thread.currentThread().getContextClassLoader().getResourceAsStream(_mapping)); - }); + public TransactionDefinition getDefinition() { + synchronized (_DEFINITIONS) { + return _DEFINITIONS.computeIfAbsent(_mapping, k -> { + XStream xstream = new XStream(new StaxDriver()); + xstream.autodetectAnnotations(true); + xstream.alias("transaction", TransactionDefinition.class); + + xstream.addPermission(NoTypePermission.NONE); + xstream.addPermission(new WildcardTypePermission(new String[] {"com.imsweb.x12.**"})); + + return (TransactionDefinition)xstream.fromXML(Thread.currentThread().getContextClassLoader().getResourceAsStream(_mapping)); + }); + } } }