From 6947240fee9de9dd1f6f7f953eccfc5ff99790a8 Mon Sep 17 00:00:00 2001
From: Holger Friedrich <mail@holger-friedrich.de>
Date: Tue, 30 Sep 2025 01:01:44 +0200
Subject: [PATCH] karaf-maven-plugin: Remove try/catch blocks from tests

Error messages including the root cause are now being printed in case the test is failing.

Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
---
 .../src/it/test-aggregate-features/verify.bsh               | 6 ++----
 .../src/it/test-basic-generation/verify.bsh                 | 6 ++----
 .../src/it/test-check-dependencies-failure/verify.bsh       | 6 ++----
 .../src/it/test-check-dependencies/verify.bsh               | 6 ++----
 .../src/it/test-feature-dependencies/verify.bsh             | 6 ++----
 .../src/it/test-feature-use-base-version/verify.bsh         | 6 ++----
 .../verify.bsh                                              | 6 ++----
 .../it/test-feature-use-version-range-transitive/verify.bsh | 6 ++----
 .../src/it/test-feature-use-version-range/verify.bsh        | 6 ++----
 .../src/it/test-include-project-artifact/verify.bsh         | 6 ++----
 .../karaf-maven-plugin/src/it/test-input-file/verify.bsh    | 6 ++----
 tooling/karaf-maven-plugin/src/it/test-recursive/verify.bsh | 1 +
 .../src/it/test-rename-main-feature/verify.bsh              | 6 ++----
 .../src/it/test-repository-dependencies/verify.bsh          | 6 ++----
 .../src/it/test-simplify-bundles/verify.bsh                 | 6 ++----
 .../src/it/test-transitive-as-dependency/verify.bsh         | 6 ++----
 .../src/it/test-type-classifier/verify.bsh                  | 6 ++----
 17 files changed, 33 insertions(+), 64 deletions(-)

diff --git a/tooling/karaf-maven-plugin/src/it/test-aggregate-features/verify.bsh b/tooling/karaf-maven-plugin/src/it/test-aggregate-features/verify.bsh
index 38c7ae15c83..8f1100bb61c 100644
--- a/tooling/karaf-maven-plugin/src/it/test-aggregate-features/verify.bsh
+++ b/tooling/karaf-maven-plugin/src/it/test-aggregate-features/verify.bsh
@@ -26,9 +26,7 @@ Reader r = new FileReader(new File(basedir, "control.xml"));
 // load the features file pushed to the repository
 File generated = new File(basedir, "aggregate-features/target/feature/feature.xml");
 if (generated.exists()) {
-    try {
-        XMLAssert.assertXMLEqual(r, new FileReader(generated));
-        return true;
-    } catch (Throwable ignored) { }
+    XMLAssert.assertXMLEqual(r, new FileReader(generated));
+    return true;
 }
 return false;
diff --git a/tooling/karaf-maven-plugin/src/it/test-basic-generation/verify.bsh b/tooling/karaf-maven-plugin/src/it/test-basic-generation/verify.bsh
index 6af1a7c85e7..cf7508a2685 100644
--- a/tooling/karaf-maven-plugin/src/it/test-basic-generation/verify.bsh
+++ b/tooling/karaf-maven-plugin/src/it/test-basic-generation/verify.bsh
@@ -26,10 +26,8 @@ Reader r = new FileReader(new File(basedir, "control.xml"));
 // load the features file pushed to the repository
 File generated = new File(basedir, "target/feature/feature.xml" );
 if (generated.exists()) {
-    try {
-        XMLAssert.assertXMLEqual(r, new FileReader(generated));
-        return true;
-    } catch (Throwable ignored) { }
+    XMLAssert.assertXMLEqual(r, new FileReader(generated));
+    return true;
 }
 
 return false;
diff --git a/tooling/karaf-maven-plugin/src/it/test-check-dependencies-failure/verify.bsh b/tooling/karaf-maven-plugin/src/it/test-check-dependencies-failure/verify.bsh
index c5515354e01..b02c83fee20 100644
--- a/tooling/karaf-maven-plugin/src/it/test-check-dependencies-failure/verify.bsh
+++ b/tooling/karaf-maven-plugin/src/it/test-check-dependencies-failure/verify.bsh
@@ -26,10 +26,8 @@ Reader r = new FileReader(new File(basedir, "control.xml"));
 // load the features file pushed to the repository
 File generated = new File(basedir, "dependencies-features/target/feature/feature.xml" );
 if (generated.exists()) {
-    try {
-        XMLAssert.assertXMLEqual(r, new FileReader(generated));
-        return true;
-    } catch (Throwable ignored) { }
+    XMLAssert.assertXMLEqual(r, new FileReader(generated));
+    return true;
 }
 
 return false;
diff --git a/tooling/karaf-maven-plugin/src/it/test-check-dependencies/verify.bsh b/tooling/karaf-maven-plugin/src/it/test-check-dependencies/verify.bsh
index c5515354e01..b02c83fee20 100644
--- a/tooling/karaf-maven-plugin/src/it/test-check-dependencies/verify.bsh
+++ b/tooling/karaf-maven-plugin/src/it/test-check-dependencies/verify.bsh
@@ -26,10 +26,8 @@ Reader r = new FileReader(new File(basedir, "control.xml"));
 // load the features file pushed to the repository
 File generated = new File(basedir, "dependencies-features/target/feature/feature.xml" );
 if (generated.exists()) {
-    try {
-        XMLAssert.assertXMLEqual(r, new FileReader(generated));
-        return true;
-    } catch (Throwable ignored) { }
+    XMLAssert.assertXMLEqual(r, new FileReader(generated));
+    return true;
 }
 
 return false;
diff --git a/tooling/karaf-maven-plugin/src/it/test-feature-dependencies/verify.bsh b/tooling/karaf-maven-plugin/src/it/test-feature-dependencies/verify.bsh
index c5515354e01..b02c83fee20 100644
--- a/tooling/karaf-maven-plugin/src/it/test-feature-dependencies/verify.bsh
+++ b/tooling/karaf-maven-plugin/src/it/test-feature-dependencies/verify.bsh
@@ -26,10 +26,8 @@ Reader r = new FileReader(new File(basedir, "control.xml"));
 // load the features file pushed to the repository
 File generated = new File(basedir, "dependencies-features/target/feature/feature.xml" );
 if (generated.exists()) {
-    try {
-        XMLAssert.assertXMLEqual(r, new FileReader(generated));
-        return true;
-    } catch (Throwable ignored) { }
+    XMLAssert.assertXMLEqual(r, new FileReader(generated));
+    return true;
 }
 
 return false;
diff --git a/tooling/karaf-maven-plugin/src/it/test-feature-use-base-version/verify.bsh b/tooling/karaf-maven-plugin/src/it/test-feature-use-base-version/verify.bsh
index 6af1a7c85e7..cf7508a2685 100644
--- a/tooling/karaf-maven-plugin/src/it/test-feature-use-base-version/verify.bsh
+++ b/tooling/karaf-maven-plugin/src/it/test-feature-use-base-version/verify.bsh
@@ -26,10 +26,8 @@ Reader r = new FileReader(new File(basedir, "control.xml"));
 // load the features file pushed to the repository
 File generated = new File(basedir, "target/feature/feature.xml" );
 if (generated.exists()) {
-    try {
-        XMLAssert.assertXMLEqual(r, new FileReader(generated));
-        return true;
-    } catch (Throwable ignored) { }
+    XMLAssert.assertXMLEqual(r, new FileReader(generated));
+    return true;
 }
 
 return false;
diff --git a/tooling/karaf-maven-plugin/src/it/test-feature-use-version-range-transfer-properties/verify.bsh b/tooling/karaf-maven-plugin/src/it/test-feature-use-version-range-transfer-properties/verify.bsh
index 140050291a9..5a4f9d1a44f 100644
--- a/tooling/karaf-maven-plugin/src/it/test-feature-use-version-range-transfer-properties/verify.bsh
+++ b/tooling/karaf-maven-plugin/src/it/test-feature-use-version-range-transfer-properties/verify.bsh
@@ -26,10 +26,8 @@ Reader r = new FileReader(new File(basedir, "control.xml"));
 // load the features file pushed to the repository
 File generated = new File(basedir, "feature/target/feature/feature.xml" );
 if (generated.exists()) {
-    try {
-        XMLAssert.assertXMLEqual(r, new FileReader(generated));
-        return true;
-    } catch (Throwable ignored) { }
+    XMLAssert.assertXMLEqual(r, new FileReader(generated));
+    return true;
 }
 
 return false;
diff --git a/tooling/karaf-maven-plugin/src/it/test-feature-use-version-range-transitive/verify.bsh b/tooling/karaf-maven-plugin/src/it/test-feature-use-version-range-transitive/verify.bsh
index 140050291a9..5a4f9d1a44f 100644
--- a/tooling/karaf-maven-plugin/src/it/test-feature-use-version-range-transitive/verify.bsh
+++ b/tooling/karaf-maven-plugin/src/it/test-feature-use-version-range-transitive/verify.bsh
@@ -26,10 +26,8 @@ Reader r = new FileReader(new File(basedir, "control.xml"));
 // load the features file pushed to the repository
 File generated = new File(basedir, "feature/target/feature/feature.xml" );
 if (generated.exists()) {
-    try {
-        XMLAssert.assertXMLEqual(r, new FileReader(generated));
-        return true;
-    } catch (Throwable ignored) { }
+    XMLAssert.assertXMLEqual(r, new FileReader(generated));
+    return true;
 }
 
 return false;
diff --git a/tooling/karaf-maven-plugin/src/it/test-feature-use-version-range/verify.bsh b/tooling/karaf-maven-plugin/src/it/test-feature-use-version-range/verify.bsh
index 6af1a7c85e7..cf7508a2685 100644
--- a/tooling/karaf-maven-plugin/src/it/test-feature-use-version-range/verify.bsh
+++ b/tooling/karaf-maven-plugin/src/it/test-feature-use-version-range/verify.bsh
@@ -26,10 +26,8 @@ Reader r = new FileReader(new File(basedir, "control.xml"));
 // load the features file pushed to the repository
 File generated = new File(basedir, "target/feature/feature.xml" );
 if (generated.exists()) {
-    try {
-        XMLAssert.assertXMLEqual(r, new FileReader(generated));
-        return true;
-    } catch (Throwable ignored) { }
+    XMLAssert.assertXMLEqual(r, new FileReader(generated));
+    return true;
 }
 
 return false;
diff --git a/tooling/karaf-maven-plugin/src/it/test-include-project-artifact/verify.bsh b/tooling/karaf-maven-plugin/src/it/test-include-project-artifact/verify.bsh
index 6af1a7c85e7..cf7508a2685 100644
--- a/tooling/karaf-maven-plugin/src/it/test-include-project-artifact/verify.bsh
+++ b/tooling/karaf-maven-plugin/src/it/test-include-project-artifact/verify.bsh
@@ -26,10 +26,8 @@ Reader r = new FileReader(new File(basedir, "control.xml"));
 // load the features file pushed to the repository
 File generated = new File(basedir, "target/feature/feature.xml" );
 if (generated.exists()) {
-    try {
-        XMLAssert.assertXMLEqual(r, new FileReader(generated));
-        return true;
-    } catch (Throwable ignored) { }
+    XMLAssert.assertXMLEqual(r, new FileReader(generated));
+    return true;
 }
 
 return false;
diff --git a/tooling/karaf-maven-plugin/src/it/test-input-file/verify.bsh b/tooling/karaf-maven-plugin/src/it/test-input-file/verify.bsh
index 6af1a7c85e7..cf7508a2685 100644
--- a/tooling/karaf-maven-plugin/src/it/test-input-file/verify.bsh
+++ b/tooling/karaf-maven-plugin/src/it/test-input-file/verify.bsh
@@ -26,10 +26,8 @@ Reader r = new FileReader(new File(basedir, "control.xml"));
 // load the features file pushed to the repository
 File generated = new File(basedir, "target/feature/feature.xml" );
 if (generated.exists()) {
-    try {
-        XMLAssert.assertXMLEqual(r, new FileReader(generated));
-        return true;
-    } catch (Throwable ignored) { }
+    XMLAssert.assertXMLEqual(r, new FileReader(generated));
+    return true;
 }
 
 return false;
diff --git a/tooling/karaf-maven-plugin/src/it/test-recursive/verify.bsh b/tooling/karaf-maven-plugin/src/it/test-recursive/verify.bsh
index c2b765a31c0..eea2fae8567 100644
--- a/tooling/karaf-maven-plugin/src/it/test-recursive/verify.bsh
+++ b/tooling/karaf-maven-plugin/src/it/test-recursive/verify.bsh
@@ -21,6 +21,7 @@ import org.custommonkey.xmlunit.*;
 import java.io.*;
 import java.lang.*;
 
+// TODO fix this testcase
 //String control = "<features xmlns=\"http://karaf.apache.org/xmlns/features/v1.0.0\" name=\"test-basic-generation\"/>";
 //
 //File generated = new File( basedir, "target/feature/feature.xml" );
diff --git a/tooling/karaf-maven-plugin/src/it/test-rename-main-feature/verify.bsh b/tooling/karaf-maven-plugin/src/it/test-rename-main-feature/verify.bsh
index 6af1a7c85e7..cf7508a2685 100644
--- a/tooling/karaf-maven-plugin/src/it/test-rename-main-feature/verify.bsh
+++ b/tooling/karaf-maven-plugin/src/it/test-rename-main-feature/verify.bsh
@@ -26,10 +26,8 @@ Reader r = new FileReader(new File(basedir, "control.xml"));
 // load the features file pushed to the repository
 File generated = new File(basedir, "target/feature/feature.xml" );
 if (generated.exists()) {
-    try {
-        XMLAssert.assertXMLEqual(r, new FileReader(generated));
-        return true;
-    } catch (Throwable ignored) { }
+    XMLAssert.assertXMLEqual(r, new FileReader(generated));
+    return true;
 }
 
 return false;
diff --git a/tooling/karaf-maven-plugin/src/it/test-repository-dependencies/verify.bsh b/tooling/karaf-maven-plugin/src/it/test-repository-dependencies/verify.bsh
index 97f7ccc25c2..d0cf5bf1069 100644
--- a/tooling/karaf-maven-plugin/src/it/test-repository-dependencies/verify.bsh
+++ b/tooling/karaf-maven-plugin/src/it/test-repository-dependencies/verify.bsh
@@ -26,10 +26,8 @@ Reader r = new FileReader(new File(basedir, "control.xml"));
 // load the features file pushed to the repository
 File generated = new File(basedir, "dependency-feature-a/target/feature/feature.xml" );
 if (generated.exists()) {
-    try {
-        XMLAssert.assertXMLEqual(r, new FileReader(generated));
-        return true;
-    } catch (Throwable ignored) { }
+    XMLAssert.assertXMLEqual(r, new FileReader(generated));
+    return true;
 }
 
 return false;
diff --git a/tooling/karaf-maven-plugin/src/it/test-simplify-bundles/verify.bsh b/tooling/karaf-maven-plugin/src/it/test-simplify-bundles/verify.bsh
index 78f37fd8fad..a6398ae94c4 100644
--- a/tooling/karaf-maven-plugin/src/it/test-simplify-bundles/verify.bsh
+++ b/tooling/karaf-maven-plugin/src/it/test-simplify-bundles/verify.bsh
@@ -26,9 +26,7 @@ Reader r = new FileReader(new File(basedir, "control.xml"));
 // load the features file pushed to the repository
 File generated = new File(basedir, "simplify-features/target/feature/feature.xml");
 if (generated.exists()) {
-    try {
-        XMLAssert.assertXMLEqual(r, new FileReader(generated));
-        return true;
-    } catch (Throwable ignored) { }
+    XMLAssert.assertXMLEqual(r, new FileReader(generated));
+    return true;
 }
 return false;
diff --git a/tooling/karaf-maven-plugin/src/it/test-transitive-as-dependency/verify.bsh b/tooling/karaf-maven-plugin/src/it/test-transitive-as-dependency/verify.bsh
index 78e7571c11e..a31e48adcdd 100644
--- a/tooling/karaf-maven-plugin/src/it/test-transitive-as-dependency/verify.bsh
+++ b/tooling/karaf-maven-plugin/src/it/test-transitive-as-dependency/verify.bsh
@@ -26,10 +26,8 @@ Reader r = new FileReader(new File(basedir, "control.xml"));
 // load the features file pushed to the repository
 File generated = new File(basedir, "transitive-as-dependency-feature/target/feature/feature.xml" );
 if (generated.exists()) {
-    try {
-        XMLAssert.assertXMLEqual(r, new FileReader(generated));
-        return true;
-    } catch (Throwable ignored) { }
+    XMLAssert.assertXMLEqual(r, new FileReader(generated));
+    return true;
 }
 
 return false;
diff --git a/tooling/karaf-maven-plugin/src/it/test-type-classifier/verify.bsh b/tooling/karaf-maven-plugin/src/it/test-type-classifier/verify.bsh
index d82e6fff6c9..7d1502716ff 100644
--- a/tooling/karaf-maven-plugin/src/it/test-type-classifier/verify.bsh
+++ b/tooling/karaf-maven-plugin/src/it/test-type-classifier/verify.bsh
@@ -29,10 +29,8 @@ Reader r = new FileReader(new File(basedir, "control.xml"));
 // TODO: repository and build offline (see KARAF-2927) 
 File generated = new File(basedir, "target/feature/feature.xml");
 if (generated.exists()) {
-    try {
-        XMLAssert.assertXMLEqual(r, new FileReader(generated));
-        return true;
-    } catch (Throwable ignored) { }
+    XMLAssert.assertXMLEqual(r, new FileReader(generated));
+    return true;
 }
 
 return false;
