This is an automated email from the ASF dual-hosted git repository.

gnodet pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/felix-dev.git


The following commit(s) were added to refs/heads/master by this push:
     new 6fb7d80f99 FELIX-6660 - Update ASM to 9.6 (#238)
6fb7d80f99 is described below

commit 6fb7d80f99ed0b4bffe436d9b5bda91b4703a5a7
Author: Konrad Windszus <k...@apache.org>
AuthorDate: Mon Jan 8 20:03:10 2024 +0100

    FELIX-6660 - Update ASM to 9.6 (#238)
    
    Supports bytecode scanning for Java up to version 22
    Improve exception handling
    Require Java 8
---
 tools/osgicheck-maven-plugin/pom.xml                  |  4 ++--
 .../felix/maven/osgicheck/impl/CheckContext.java      | 19 +++++++++++++++++++
 .../impl/checks/ConsumerProviderTypeCheck.java        |  2 +-
 3 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/tools/osgicheck-maven-plugin/pom.xml 
b/tools/osgicheck-maven-plugin/pom.xml
index d8705f2d91..2ff2070122 100644
--- a/tools/osgicheck-maven-plugin/pom.xml
+++ b/tools/osgicheck-maven-plugin/pom.xml
@@ -76,8 +76,8 @@
     <dependencies>
         <dependency>
             <groupId>org.ow2.asm</groupId>
-            <artifactId>asm-all</artifactId>
-            <version>5.2</version>
+            <artifactId>asm-tree</artifactId>
+            <version>9.6</version>
         </dependency>
         <dependency>
             <groupId>org.apache.maven</groupId>
diff --git 
a/tools/osgicheck-maven-plugin/src/main/java/org/apache/felix/maven/osgicheck/impl/CheckContext.java
 
b/tools/osgicheck-maven-plugin/src/main/java/org/apache/felix/maven/osgicheck/impl/CheckContext.java
index 6b9da17927..abb00090cb 100644
--- 
a/tools/osgicheck-maven-plugin/src/main/java/org/apache/felix/maven/osgicheck/impl/CheckContext.java
+++ 
b/tools/osgicheck-maven-plugin/src/main/java/org/apache/felix/maven/osgicheck/impl/CheckContext.java
@@ -17,10 +17,13 @@
 package org.apache.felix.maven.osgicheck.impl;
 
 import java.io.File;
+import java.io.PrintWriter;
+import java.io.StringWriter;
 import java.util.Map;
 import java.util.jar.Manifest;
 
 import org.apache.maven.plugin.logging.Log;
+import org.codehaus.plexus.util.StringUtils;
 
 public interface CheckContext {
 
@@ -45,4 +48,20 @@ public interface CheckContext {
      * @param message The message.
      */
     void reportError(String message);
+
+    /**
+     * This method is invoked by a {@link Check} to report
+     * an exception.
+     * @param message The message.
+     */
+    default void reportError(String message, Throwable cause) {
+        StringWriter sw = new StringWriter();
+        PrintWriter pw = new PrintWriter(sw);
+        if (StringUtils.isNotBlank(message)) {
+            pw.print(message);
+            pw.println(":");
+        }
+        cause.printStackTrace(pw);
+        reportError(sw.toString());
+    }
 }
diff --git 
a/tools/osgicheck-maven-plugin/src/main/java/org/apache/felix/maven/osgicheck/impl/checks/ConsumerProviderTypeCheck.java
 
b/tools/osgicheck-maven-plugin/src/main/java/org/apache/felix/maven/osgicheck/impl/checks/ConsumerProviderTypeCheck.java
index 7bb16c9a21..a98cd1da93 100644
--- 
a/tools/osgicheck-maven-plugin/src/main/java/org/apache/felix/maven/osgicheck/impl/checks/ConsumerProviderTypeCheck.java
+++ 
b/tools/osgicheck-maven-plugin/src/main/java/org/apache/felix/maven/osgicheck/impl/checks/ConsumerProviderTypeCheck.java
@@ -115,7 +115,7 @@ public class ConsumerProviderTypeCheck implements Check {
                 ctx.reportError("Class " + className + " declares ConsumerType 
and ProducerType");
             }
         } catch (final IllegalArgumentException | IOException ioe) {
-            ctx.reportError("Unable to scan annotations " + ioe.getMessage());
+            ctx.reportError("Unable to scan annotations in class file " + 
classFile, ioe);
         }
     }
 

Reply via email to