You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sl...@apache.org on 2023/04/01 14:38:37 UTC

[maven-dependency-analyzer] branch MSHARED-1149 created (now 43a2456)

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

slachiewicz pushed a change to branch MSHARED-1149
in repository https://gitbox.apache.org/repos/asf/maven-dependency-analyzer.git


      at 43a2456  [MSHARED-1149] Replace System.out by logger

This branch includes the following new commits:

     new 43a2456  [MSHARED-1149] Replace System.out by logger

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[maven-dependency-analyzer] 01/01: [MSHARED-1149] Replace System.out by logger

Posted by sl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a commit to branch MSHARED-1149
in repository https://gitbox.apache.org/repos/asf/maven-dependency-analyzer.git

commit 43a2456006a736f51db9cecf0e9729dea267b02e
Author: Koziolek <bj...@gmail.com>
AuthorDate: Sat Oct 22 20:50:40 2022 +0200

    [MSHARED-1149] Replace System.out by logger
---
 pom.xml                                                    | 14 ++++++++++++++
 .../analyzer/asm/DependencyClassFileVisitor.java           |  6 +++++-
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index d512533..52946c8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -58,6 +58,7 @@
 
   <properties>
     <mavenVersion>3.2.5</mavenVersion>
+    <slf4jVersion>1.7.36</slf4jVersion>
     <javaVersion>8</javaVersion>
     <project.build.outputTimestamp>2022-08-20T15:25:47Z</project.build.outputTimestamp>
   </properties>
@@ -93,6 +94,13 @@
       <version>9.5</version>
     </dependency>
 
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+      <version>${slf4jVersion}</version>
+    </dependency>
+
+    <!-- testing support -->
     <dependency>
       <groupId>commons-io</groupId>
       <artifactId>commons-io</artifactId>
@@ -112,6 +120,12 @@
       <version>3.24.2</version>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-simple</artifactId>
+      <version>${slf4jVersion}</version>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
   <build>
diff --git a/src/main/java/org/apache/maven/shared/dependency/analyzer/asm/DependencyClassFileVisitor.java b/src/main/java/org/apache/maven/shared/dependency/analyzer/asm/DependencyClassFileVisitor.java
index 79b2c99..8c1cd3d 100644
--- a/src/main/java/org/apache/maven/shared/dependency/analyzer/asm/DependencyClassFileVisitor.java
+++ b/src/main/java/org/apache/maven/shared/dependency/analyzer/asm/DependencyClassFileVisitor.java
@@ -30,6 +30,8 @@ import org.objectweb.asm.ClassVisitor;
 import org.objectweb.asm.FieldVisitor;
 import org.objectweb.asm.MethodVisitor;
 import org.objectweb.asm.signature.SignatureVisitor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * Computes the set of classes referenced by visited class files, using
@@ -41,6 +43,8 @@ import org.objectweb.asm.signature.SignatureVisitor;
 public class DependencyClassFileVisitor implements ClassFileVisitor {
     private final ResultCollector resultCollector = new ResultCollector();
 
+    private final Logger logger = LoggerFactory.getLogger(getClass());
+
     /**
      * <p>Constructor for DependencyClassFileVisitor.</p>
      */
@@ -70,7 +74,7 @@ public class DependencyClassFileVisitor implements ClassFileVisitor {
         } catch (IndexOutOfBoundsException e) {
             // some bug inside ASM causes an IOB exception. Log it and move on?
             // this happens when the class isn't valid.
-            System.out.println("Unable to process: " + className);
+            logger.warn("Unable to process: " + className);
         }
     }