[MNG-6636] merge reports location tracking

- avoids NPE during DefaultReportingConverter work
- fixes missing location tracking when parent values injected into
  existing child values
This commit is contained in:
Hervé Boutemy 2019-04-26 03:12:43 +02:00
parent 1e03388d5b
commit 869b615189
1 changed files with 18 additions and 0 deletions

View File

@ -1475,6 +1475,24 @@ protected void mergeReportSet_Reports( ReportSet target, ReportSet source, boole
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 ) ) );
}
}
}
}
}