You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mi...@apache.org on 2023/04/15 11:05:07 UTC

[maven-doxia-sitetools] branch DOXIASITETOOLS-303 updated (8290440 -> 5c8fddd)

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

michaelo pushed a change to branch DOXIASITETOOLS-303
in repository https://gitbox.apache.org/repos/asf/maven-doxia-sitetools.git


    omit 8290440  [DOXIASITETOOLS-303] Implement workaround for MNG-7758/MRESOLVER-335
     add 5bc6f27  Improve log messages
     add 60e5b67  [DOXIASITETOOLS-301] Automatically remove the 0-byte site descriptors from the local repo
     new 5c8fddd  [DOXIASITETOOLS-303] Implement workaround for MNG-7758/MRESOLVER-335

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (8290440)
            \
             N -- N -- N   refs/heads/DOXIASITETOOLS-303 (5c8fddd)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

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.


Summary of changes:
 .../apache/maven/doxia/tools/DefaultSiteTool.java  | 40 ++++++++++++++++++++--
 1 file changed, 38 insertions(+), 2 deletions(-)


[maven-doxia-sitetools] 01/01: [DOXIASITETOOLS-303] Implement workaround for MNG-7758/MRESOLVER-335

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

michaelo pushed a commit to branch DOXIASITETOOLS-303
in repository https://gitbox.apache.org/repos/asf/maven-doxia-sitetools.git

commit 5c8fddd95dd048c629f912cd7d90cea3103a02d6
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Sun Apr 9 21:58:58 2023 +0200

    [DOXIASITETOOLS-303] Implement workaround for MNG-7758/MRESOLVER-335
    
    This closes #103
---
 .../apache/maven/doxia/tools/DefaultSiteTool.java  | 30 +++++++++++++---------
 1 file changed, 18 insertions(+), 12 deletions(-)

diff --git a/doxia-integration-tools/src/main/java/org/apache/maven/doxia/tools/DefaultSiteTool.java b/doxia-integration-tools/src/main/java/org/apache/maven/doxia/tools/DefaultSiteTool.java
index 98ded34..ece115c 100644
--- a/doxia-integration-tools/src/main/java/org/apache/maven/doxia/tools/DefaultSiteTool.java
+++ b/doxia-integration-tools/src/main/java/org/apache/maven/doxia/tools/DefaultSiteTool.java
@@ -358,10 +358,13 @@ public class DefaultSiteTool implements SiteTool {
         Objects.requireNonNull(locale, "locale cannot be null");
 
         try {
-            return resolveSiteDescriptor(project, repoSession, remoteProjectRepositories, locale);
-        } catch (ArtifactNotFoundException e) {
-            LOGGER.debug("Unable to locate site descriptor", e);
-            return null;
+            File siteDescriptor = resolveSiteDescriptor(project, repoSession, remoteProjectRepositories, locale);
+            if (siteDescriptor == null) {
+                LOGGER.debug("Site descriptor not found");
+                return null;
+            } else {
+                return siteDescriptor;
+            }
         } catch (ArtifactResolutionException e) {
             throw new SiteToolException("Unable to locate site descriptor", e);
         } catch (IOException e) {
@@ -815,17 +818,16 @@ public class DefaultSiteTool implements SiteTool {
      * @param repoSession the repository system session not null
      * @param remoteProjectRepositories not null
      * @param locale not null
-     * @return the resolved site descriptor
+     * @return the resolved site descriptor or null if not found in repositories.
      * @throws IOException if any
      * @throws ArtifactResolutionException if any
-     * @throws ArtifactNotFoundException if any
      */
     private File resolveSiteDescriptor(
             MavenProject project,
             RepositorySystemSession repoSession,
             List<RemoteRepository> remoteProjectRepositories,
             Locale locale)
-            throws IOException, ArtifactResolutionException, ArtifactNotFoundException {
+            throws IOException, ArtifactResolutionException {
         String variant = locale.getVariant();
         String country = locale.getCountry();
         String language = locale.getLanguage();
@@ -847,7 +849,8 @@ public class DefaultSiteTool implements SiteTool {
                 siteDescriptor = result.getArtifact().getFile();
                 found = true;
             } catch (ArtifactResolutionException e) {
-                if (e.getCause() instanceof ArtifactNotFoundException) {
+                // This is a workaround for MNG-7758/MRESOLVER-335
+                if (e.getResult().getExceptions().stream().anyMatch(re -> re instanceof ArtifactNotFoundException)) {
                     LOGGER.debug("No site descriptor found for '" + project.getId() + "' for locale '" + localeStr
                             + "', trying without variant...");
                 } else {
@@ -869,7 +872,8 @@ public class DefaultSiteTool implements SiteTool {
                 siteDescriptor = result.getArtifact().getFile();
                 found = true;
             } catch (ArtifactResolutionException e) {
-                if (e.getCause() instanceof ArtifactNotFoundException) {
+                // This is a workaround for MNG-7758/MRESOLVER-335
+                if (e.getResult().getExceptions().stream().anyMatch(re -> re instanceof ArtifactNotFoundException)) {
                     LOGGER.debug("No site descriptor found for '" + project.getId() + "' for locale '" + localeStr
                             + "', trying without country...");
                 } else {
@@ -891,7 +895,8 @@ public class DefaultSiteTool implements SiteTool {
                 siteDescriptor = result.getArtifact().getFile();
                 found = true;
             } catch (ArtifactResolutionException e) {
-                if (e.getCause() instanceof ArtifactNotFoundException) {
+                // This is a workaround for MNG-7758/MRESOLVER-335
+                if (e.getResult().getExceptions().stream().anyMatch(re -> re instanceof ArtifactNotFoundException)) {
                     LOGGER.debug("No site descriptor found for '" + project.getId() + "' for locale '" + localeStr
                             + "', trying without language (default locale)...");
                 } else {
@@ -912,9 +917,10 @@ public class DefaultSiteTool implements SiteTool {
 
                 siteDescriptor = result.getArtifact().getFile();
             } catch (ArtifactResolutionException e) {
-                if (e.getCause() instanceof ArtifactNotFoundException) {
+                // This is a workaround for MNG-7758/MRESOLVER-335
+                if (e.getResult().getExceptions().stream().anyMatch(re -> re instanceof ArtifactNotFoundException)) {
                     LOGGER.debug("No site descriptor found for '" + project.getId() + "' with default locale");
-                    throw (ArtifactNotFoundException) e.getCause();
+                    return null;
                 }
 
                 throw e;