From 93f873c623bc8c41fd0e1903e1bb9e3e3eebd611 Mon Sep 17 00:00:00 2001
From: loong10k <20489781+loong10k@users.noreply.github.com>
Date: Wed, 4 Nov 2026 03:14:18 +0800
Subject: [PATCH 1/2] fix: update Jackson 2 and restore JaCoCo coverage
collection
---
.github/workflows/ci.yml | 4 ++--
pom.xml | 9 +++++++--
.../easy4j/opencli/parser/OpenCliStdoutJson.java | 4 +++-
.../opencli/parser/OpenCliStdoutJsonTest.java | 13 +++++++++++++
4 files changed, 25 insertions(+), 5 deletions(-)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 61fc12c..ea713b5 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -4,8 +4,8 @@
# - push / pull_request on the main branch
# - manual workflow_dispatch
#
-# Runs `mvn -B clean verify` which includes the JaCoCo coverage gate
-# (90% line coverage, haltOnFailure=false) configured in the POM.
+# Runs `mvn -B clean verify` which collects JaCoCo coverage and checks the target
+# (90% line coverage, warning only: haltOnFailure=false) configured in the POM.
name: CI
on:
diff --git a/pom.xml b/pom.xml
index c92d615..1f517d4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -57,11 +57,13 @@
${java.version}
${java.version}
3.0
+
+
UTF-8
1.6.0
2.6
- 2.17.2
+ 2.22.4
1.6.0
6.1.0
4.13.2
@@ -344,7 +346,7 @@
false
false
- -Xmx1024m -Dfile.encoding=UTF-8
+ @{jacocoArgLine} -Xmx1024m -Dfile.encoding=UTF-8
${basedir}/target/test-classes
@@ -423,6 +425,9 @@
prepare-agent
+
+ jacocoArgLine
+
prepare-agent
diff --git a/src/main/java/io/github/easy4j/opencli/parser/OpenCliStdoutJson.java b/src/main/java/io/github/easy4j/opencli/parser/OpenCliStdoutJson.java
index ffbe310..bae8ca8 100644
--- a/src/main/java/io/github/easy4j/opencli/parser/OpenCliStdoutJson.java
+++ b/src/main/java/io/github/easy4j/opencli/parser/OpenCliStdoutJson.java
@@ -41,7 +41,9 @@ public static JsonNode parseLenient(String stdout) {
}
String trim = stdout.trim();
try {
- return MAPPER.readTree(trim);
+ JsonNode node = MAPPER.readTree(trim);
+ return node == null || node.isMissingNode()
+ ? MAPPER.getNodeFactory().textNode(stdout) : node;
} catch (JsonProcessingException e) {
log.debug("stdout is not strict JSON, wrapping as text: {}", e.getMessage());
return MAPPER.getNodeFactory().textNode(stdout);
diff --git a/src/test/java/io/github/easy4j/opencli/parser/OpenCliStdoutJsonTest.java b/src/test/java/io/github/easy4j/opencli/parser/OpenCliStdoutJsonTest.java
index bea5a49..6867645 100644
--- a/src/test/java/io/github/easy4j/opencli/parser/OpenCliStdoutJsonTest.java
+++ b/src/test/java/io/github/easy4j/opencli/parser/OpenCliStdoutJsonTest.java
@@ -9,6 +9,19 @@
class OpenCliStdoutJsonTest {
+ @Test
+ void shouldPreserveWhitespaceOnlyOutput() {
+ assertEquals(" \n\t ", OpenCliStdoutJson.parseLenient(" \n\t ").textValue());
+ }
+
+ @Test
+ void shouldRetainJacksonTwoNodeContract() {
+ assertTrue(OpenCliStdoutJson.parseLenient("null").isNull());
+ assertEquals("hello", OpenCliStdoutJson.parseLenient("\"hello\"").textValue());
+ assertEquals(42, OpenCliStdoutJson.parseLenient("42").intValue());
+ assertEquals("{broken", OpenCliStdoutJson.parseLenient("{broken").textValue());
+ }
+
@Test
void shouldParseValidJsonObject() {
JsonNode node = OpenCliStdoutJson.parseLenient("{\"a\":1}");
From 401920e837d1152ff3ae289ea287caaf232a569f Mon Sep 17 00:00:00 2001
From: loong10k <20489781+loong10k@users.noreply.github.com>
Date: Wed, 4 Nov 2026 03:15:03 +0800
Subject: [PATCH 2/2] ci: require generated JaCoCo execution data and report
---
.github/workflows/ci.yml | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index ea713b5..3d09f57 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -35,7 +35,10 @@ jobs:
cache: maven
- name: Build and verify with JaCoCo coverage gate
- run: mvn -B --no-transfer-progress clean verify
+ run: |
+ mvn -B --no-transfer-progress clean verify
+ test -s target/jacoco.exec
+ test -s target/site/jacoco/jacoco.xml
- name: Upload JaCoCo coverage report
if: always()