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/26 01:14:02 UTC
[maven] 01/01: [MNG-6636] merge reports location tracking
This is an automated email from the ASF dual-hosted git repository.
hboutemy pushed a commit to branch MNG-6636
in repository https://gitbox.apache.org/repos/asf/maven.git
commit dc043c978b48cfe05cd2d5ebd86f8f6c82702f95
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 ) ) );
+ }
+ }
+ }
}
}