You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2019/04/28 17:42:52 UTC

[maven] 01/02: [MNG-6636] merge reports location tracking

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

hboutemy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven.git

commit 869b615189fd05eb1216a66178eb22b72ea0b4d3
Author: Hervé Boutemy <hb...@apache.org>
AuthorDate: Fri Apr 26 03:12:43 2019 +0200

    [MNG-6636] merge reports location tracking
    
    - avoids NPE during DefaultReportingConverter work
    - fixes missing location tracking when parent values injected into
      existing child values
---
 .../java/org/apache/maven/model/merge/ModelMerger.java | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/maven-model/src/main/java/org/apache/maven/model/merge/ModelMerger.java b/maven-model/src/main/java/org/apache/maven/model/merge/ModelMerger.java
index 5848f59..8b4e0cd 100644
--- a/maven-model/src/main/java/org/apache/maven/model/merge/ModelMerger.java
+++ b/maven-model/src/main/java/org/apache/maven/model/merge/ModelMerger.java
@@ -1475,6 +1475,24 @@ public class ModelMerger
             merged.addAll( tgt );
             merged.addAll( src );
             target.setReports( merged );
+
+            InputLocation sourceLocation = source.getLocation( "reports" );
+            if ( sourceLocation != null )
+            {
+                InputLocation targetLocation = target.getLocation( "reports" );
+                if ( targetLocation == null )
+                {
+                    target.setLocation( "reports", sourceLocation );
+                }
+                else
+                {
+                    for ( int i = 0; i < src.size(); i++ )
+                    {
+                        targetLocation.setLocation( Integer.valueOf( tgt.size() + i ),
+                                                    sourceLocation.getLocation( Integer.valueOf( i ) ) );
+                    }
+                }
+            }
         }
     }