From 3c3db16926e60c6cc0315814384f18c9bebaf503 Mon Sep 17 00:00:00 2001
From: Giovanni van der Schelde <gvdschelde@gmail.com>
Date: Mon, 21 Oct 2024 14:10:11 +0200
Subject: [PATCH] Only warn with error message unless debug is enabled

---
 .../maven/archetype/DefaultArchetypeManager.java  | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/DefaultArchetypeManager.java b/archetype-common/src/main/java/org/apache/maven/archetype/DefaultArchetypeManager.java
index 5587a952..56e7e54e 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/DefaultArchetypeManager.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/DefaultArchetypeManager.java
@@ -146,7 +146,10 @@ public ArchetypeCatalog getInternalCatalog() {
 
             return source.getArchetypeCatalog(null, null);
         } catch (ArchetypeDataSourceException e) {
-            getLogger().warn("failed to read catalog", e);
+            getLogger()
+                    .warn(
+                            "failed to read catalog: " + e.getMessage(),
+                            getLogger().isDebugEnabled() ? e : null);
             return new ArchetypeCatalog();
         }
     }
@@ -158,7 +161,10 @@ public ArchetypeCatalog getLocalCatalog(RepositorySystemSession repositorySessio
 
             return source.getArchetypeCatalog(repositorySession, null);
         } catch (ArchetypeDataSourceException e) {
-            getLogger().warn("failed to read catalog", e);
+            getLogger()
+                    .warn(
+                            "failed to read catalog: " + e.getMessage(),
+                            getLogger().isDebugEnabled() ? e : null);
             return new ArchetypeCatalog();
         }
     }
@@ -171,7 +177,10 @@ public ArchetypeCatalog getRemoteCatalog(
 
             return source.getArchetypeCatalog(repositorySession, remoteRepositories);
         } catch (ArchetypeDataSourceException e) {
-            getLogger().warn("failed to download from remote", e);
+            getLogger()
+                    .warn(
+                            "failed to download from remote" + e.getMessage(),
+                            getLogger().isDebugEnabled() ? e : null);
             return new ArchetypeCatalog();
         }
     }