diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 6af8031..20f49b4 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -42,41 +42,29 @@ jobs:
PKGFOLDER="org/weasis/core/weasis-core-img"
TAG_VERSION=${{ env.LIB_VERSION }}
F_META="maven-metadata.xml"
- cd ~/.m2/repository/${PKGFOLDER}
- find . -name "*.jar" -o -name "*.pom" | cpio -updm ${REPO}/${PKGFOLDER}
- cd ${REPO}/${PKGFOLDER}
-
- xmlstarlet ed --inplace -u "//metadata/version" -v ${TAG_VERSION} -u "//metadata/versioning/release" -v ${TAG_VERSION} \
- -u "//metadata/versioning/lastUpdated" -v $(date "+%Y%m%d%H%M%S") ${F_META}
-
- IFS=$'\n'
- versions=$(xmlstarlet sel -t -m "//metadata/versioning/versions" -v version ${F_META})
- if printf '%s\n' "${versions[@]}" | grep -q -P "^${TAG_VERSION}$"; then
- :
- else
- xmlstarlet ed --inplace -s "//metadata/versioning/versions" -t elem -n "version" -v ${TAG_VERSION} ${F_META}
- fi
- cd ~/.m2/repository/${PKGFOLDER}-bom
- find . -name "*.jar" -o -name "*.pom" | cpio -updm ${REPO}/${PKGFOLDER}-bom
- cd ${REPO}/${PKGFOLDER}-bom
-
- xmlstarlet ed --inplace -u "//metadata/version" -v ${TAG_VERSION} -u "//metadata/versioning/release" -v ${TAG_VERSION} \
- -u "//metadata/versioning/lastUpdated" -v $(date "+%Y%m%d%H%M%S") ${F_META}
-
- IFS=$'\n'
- versions=$(xmlstarlet sel -t -m "//metadata/versioning/versions" -v version ${F_META})
- if printf '%s\n' "${versions[@]}" | grep -q -P "^${TAG_VERSION}$"; then
- :
- else
- xmlstarlet ed --inplace -s "//metadata/versioning/versions" -t elem -n "version" -v ${TAG_VERSION} ${F_META}
- fi
-
- paths=($(find . -name "*.pom" -o -name "${F_META}"))
- for file in ${paths[@]}; do
+ function update_metadata() {
+ cd ~/.m2/repository/${1}
+ find . -name "*.jar" -o -name "*.pom" | cpio -updm ${REPO}/${1}
+ cd ${REPO}/${1}
+
+ xmlstarlet ed --inplace -u "//metadata/version" -v ${TAG_VERSION} -u "//metadata/versioning/release" -v ${TAG_VERSION} \
+ -u "//metadata/versioning/lastUpdated" -v $(date "+%Y%m%d%H%M%S") ${F_META}
+
+ versions=$(xmlstarlet sel -t -m "//metadata/versioning/versions" -v version ${F_META})
+ if ! printf '%s\n' "${versions[@]}" | grep -q -P "^${TAG_VERSION}$"; then
+ xmlstarlet ed --inplace -s "//metadata/versioning/versions" -t elem -n "version" -v ${TAG_VERSION} ${F_META}
+ fi
+
+ paths=($(find . -name "*.pom" -o -name "${F_META}"))
+ for file in ${paths[@]}; do
$(sha1sum "${file}" | awk '{printf $1}' > "${file}".sha1)
$(md5sum "${file}" | awk '{printf $1}' > "${file}".md5)
- done
+ done
+ }
+
+ update_metadata ${PKGFOLDER}
+ update_metadata ${PKGFOLDER}-bom
git config user.name github-actions
git config user.email github-actions@github.com
diff --git a/pom.xml b/pom.xml
index 72e819c..03813b0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -33,6 +33,37 @@
weasis-core-img
+
+
+ Eclipse Public License v2.0
+ https://www.eclipse.org/legal/epl-v20.html
+ repo
+
+
+ Apache License v2.0
+ https://www.apache.org/licenses/LICENSE-2.0
+ repo
+
+
+
+
+
+ central
+ Central Repository
+ https://repo.maven.apache.org/maven2
+
+ false
+
+
+
+ mvn-repo-master
+ https://raw.github.com/nroduit/mvn-repo/master/
+
+ false
+
+
+
+
@@ -106,6 +137,81 @@
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.12.1
+
+
+ org.apache.maven.plugins
+ maven-install-plugin
+ 3.1.1
+
+
+ org.apache.maven.plugins
+ maven-clean-plugin
+ 3.3.2
+
+
+ org.apache.maven.plugins
+ maven-deploy-plugin
+ 3.1.1
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+ 3.3.0
+
+
+ org.apache.felix
+ maven-bundle-plugin
+ 5.1.9
+
+
+ org.apache.maven.plugins
+ maven-dependency-plugin
+ 3.6.1
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 3.2.5
+
+
+ org.apache.maven.plugins
+ maven-source-plugin
+ 3.3.0
+
+
+ org.apache.maven.plugins
+ maven-enforcer-plugin
+ 3.4.1
+
+
+ org.apache.maven.plugins
+ maven-resources-plugin
+ 3.3.1
+
+
+ org.apache.maven.plugins
+ maven-site-plugin
+ 4.0.0-M13
+
+
+ org.codehaus.mojo
+ build-helper-maven-plugin
+ 3.5.0
+
+
+ org.jacoco
+ jacoco-maven-plugin
+ 0.8.11
+
+
+ com.diffplug.spotless
+ spotless-maven-plugin
+ 2.43.0
+
org.codehaus.mojo
flatten-maven-plugin
diff --git a/weasis-core-img/pom.xml b/weasis-core-img/pom.xml
index bee2ccf..85857cd 100644
--- a/weasis-core-img/pom.xml
+++ b/weasis-core-img/pom.xml
@@ -50,117 +50,7 @@
-Djava.library.path=${project.build.directory}/lib/${os-name}-${cpu-name}
-
-
- Eclipse Public License v2.0
- https://www.eclipse.org/legal/epl-v20.html
- repo
-
-
- Apache License v2.0
- https://www.apache.org/licenses/LICENSE-2.0
- repo
-
-
-
-
-
- central
- Central Repository
- https://repo.maven.apache.org/maven2
-
- false
-
-
-
- mvn-repo-master
- https://raw.github.com/nroduit/mvn-repo/master/
-
- false
-
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- 3.12.1
-
-
- org.apache.maven.plugins
- maven-install-plugin
- 3.1.1
-
-
- org.apache.maven.plugins
- maven-clean-plugin
- 3.3.2
-
-
- org.apache.maven.plugins
- maven-deploy-plugin
- 3.1.1
-
-
- org.apache.maven.plugins
- maven-jar-plugin
- 3.3.0
-
-
- org.apache.felix
- maven-bundle-plugin
- 5.1.9
-
-
- org.apache.maven.plugins
- maven-dependency-plugin
- 3.6.1
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
- 3.2.5
-
-
- org.apache.maven.plugins
- maven-source-plugin
- 3.3.0
-
-
- org.apache.maven.plugins
- maven-enforcer-plugin
- 3.4.1
-
-
- org.apache.maven.plugins
- maven-resources-plugin
- 3.3.1
-
-
- org.apache.maven.plugins
- maven-site-plugin
- 4.0.0-M13
-
-
- org.codehaus.mojo
- build-helper-maven-plugin
- 3.5.0
-
-
- org.jacoco
- jacoco-maven-plugin
- 0.8.11
-
-
- com.diffplug.spotless
- spotless-maven-plugin
- 2.43.0
-
-
-
org.apache.maven.plugins
diff --git a/weasis-core-img/src/main/java/org/weasis/core/util/NativeLibrary.java b/weasis-core-img/src/main/java/org/weasis/core/util/NativeLibrary.java
index c0ac99d..9e74a69 100644
--- a/weasis-core-img/src/main/java/org/weasis/core/util/NativeLibrary.java
+++ b/weasis-core-img/src/main/java/org/weasis/core/util/NativeLibrary.java
@@ -17,6 +17,7 @@ public static String getNativeLibSpecification() {
// See naming conventions at https://docs.osgi.org/reference/osnames.html
String osName = System.getProperty("os.name").toLowerCase();
String osArch = System.getProperty("os.arch").toLowerCase();
+
if (osName.startsWith("win")) {
// All Windows versions with a specific processor architecture (x86 or x86-64) are grouped
// under windows. If you need to make different native libraries for the Windows versions,
@@ -26,38 +27,25 @@ public static String getNativeLibSpecification() {
osName = "macosx";
} else if (osName.startsWith("linux")) {
osName = "linux";
- } else if (osName.equals("symbianos")) {
- osName = "epoc32";
- } else if (osName.equals("hp-ux")) {
- osName = "hpux";
- } else if (osName.equals("os/2")) {
- osName = "os2";
- } else if (osName.equals("procnto")) {
- osName = "qnx";
} else {
- osName = osName.toLowerCase();
+ switch (osName) {
+ case "symbianos" -> osName = "epoc32";
+ case "hp-ux" -> osName = "hpux";
+ case "os/2" -> osName = "os2";
+ case "procnto" -> osName = "qnx";
+ default -> osName = osName.toLowerCase();
+ }
}
- if (osArch.equals("x86-64")
- || osArch.equals("amd64")
- || osArch.equals("em64t")
- || osArch.equals("x86_64")) {
- osArch = "x86-64";
- } else if (osArch.equals("aarch64") || osArch.equals("arm64")) {
- osArch = "aarch64";
- } else if (osArch.equals("arm")) {
- osArch = "armv7a";
- } else if (osArch.equals("pentium")
- || osArch.equals("i386")
- || osArch.equals("i486")
- || osArch.equals("i586")
- || osArch.equals("i686")) {
- osArch = "x86";
- } else if (osArch.equals("power ppc")) {
- osArch = "powerpc";
- } else if (osArch.equals("psc1k")) {
- osArch = "ignite";
- }
+ osArch = switch (osArch) {
+ case "x86-64", "amd64", "em64t", "x86_64" -> "x86-64";
+ case "aarch64", "arm64" -> "aarch64";
+ case "arm" -> "armv7a";
+ case "pentium", "i386", "i486", "i586", "i686" -> "x86";
+ case "power ppc" -> "powerpc";
+ case "psc1k" -> "ignite";
+ default -> osArch;
+ };
return osName + "-" + osArch;
}
diff --git a/weasis-core-img/src/main/java/org/weasis/core/util/StringUtil.java b/weasis-core-img/src/main/java/org/weasis/core/util/StringUtil.java
index 8454802..04b8db3 100644
--- a/weasis-core-img/src/main/java/org/weasis/core/util/StringUtil.java
+++ b/weasis-core-img/src/main/java/org/weasis/core/util/StringUtil.java
@@ -181,7 +181,7 @@ public static boolean hasText(String str) {
/**
* Removing diacritical marks aka accents
*
- * @param str
+ * @param str the input string
* @return the input string without accents
*/
public static String deAccent(String str) {
diff --git a/weasis-core-img/src/main/java/org/weasis/opencv/op/ImageProcessor.java b/weasis-core-img/src/main/java/org/weasis/opencv/op/ImageProcessor.java
index a7db227..d09d090 100644
--- a/weasis-core-img/src/main/java/org/weasis/opencv/op/ImageProcessor.java
+++ b/weasis-core-img/src/main/java/org/weasis/opencv/op/ImageProcessor.java
@@ -863,7 +863,6 @@ public static boolean writePNG(Mat source, File file) {
int elemSize = CvType.ELEM_SIZE(type);
int channels = CvType.channels(type);
int bpp = (elemSize * 8) / channels;
- // TODO should test is the library can write 16 bit image
if (bpp > 16 || !CvType.isInteger(type)) {
dstImg = new Mat();
srcImg.convertTo(dstImg, CvType.CV_16SC(channels));