You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Hervé BOUTEMY <he...@free.fr> on 2019/04/12 17:23:51 UTC

Re: [maven] 01/01: Fix reports Location NPE

this avoid the NPE but does not fix the root cause = missing input location 
tracking
see first comment of https://issues.apache.org/jira/browse/MNG-6636

Do you want to try to fix the root cause?

Regards,

Hervé

Le jeudi 11 avril 2019, 22:06:00 CEST slachiewicz@apache.org a écrit :
> This is an automated email from the ASF dual-hosted git repository.
> 
> slachiewicz pushed a commit to branch reportsLocation-npe
> in repository https://gitbox.apache.org/repos/asf/maven.git
> 
> commit 38c70be83341d8198e7f8e53a31709b2336da162
> Author: Sylwester Lachiewicz <sl...@apache.org>
> AuthorDate: Thu Apr 11 22:05:23 2019 +0200
> 
>     Fix reports Location NPE
> ---
>  .../apache/maven/model/plugin/DefaultReportingConverter.java   | 10
> +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git
> a/maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultRe
> portingConverter.java
> b/maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultRe
> portingConverter.java index 683f494..2571104 100644
> ---
> a/maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultRe
> portingConverter.java +++
> b/maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultRe
> portingConverter.java @@ -235,12 +235,16 @@ public class
> DefaultReportingConverter
> 
>          if ( !reportSet.getReports().isEmpty() )
>          {
> -            InputLocation location = reportSet.getLocation( "reports" );
> -            Xpp3Dom reports = new Xpp3Dom( "reports", location );
> +            InputLocation reportsLocation = reportSet.getLocation(
> "reports" ); +            if ( reportsLocation == null )
> +            {
> +                reportsLocation = location;
> +            }
> +            Xpp3Dom reports = new Xpp3Dom( "reports", reportsLocation );
>              int n = 0;
>              for ( String report : reportSet.getReports() )
>              {
> -                addDom( reports, "report", report, location.getLocation(
> n++ ) ); +                addDom( reports, "report", report,
> reportsLocation.getLocation( n++ ) ); }
>              dom.addChild( reports );
>          }





---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: [maven] 01/01: Fix reports Location NPE

Posted by Hervé BOUTEMY <he...@free.fr>.
this would have been the opportunity to dig deeper into model inheritance 
through this input location tracking feature

I won't have time to work on it for now, so don't hesitate to try

Regards,

Hervé

Le vendredi 12 avril 2019, 19:39:53 CEST Sylwester Lachiewicz a écrit :
> I thought that this simple fix fixes the error, but if there is some other
> reason I think you will be able to fix it better :)
> Sylwester
> 
> pt., 12 kwi 2019 o 19:23 Hervé BOUTEMY <he...@free.fr> napisał(a):
> > this avoid the NPE but does not fix the root cause = missing input
> > location
> > tracking
> > see first comment of https://issues.apache.org/jira/browse/MNG-6636
> > 
> > Do you want to try to fix the root cause?
> > 
> > Regards,
> > 
> > Hervé
> > 
> > Le jeudi 11 avril 2019, 22:06:00 CEST slachiewicz@apache.org a écrit :
> > > This is an automated email from the ASF dual-hosted git repository.
> > > 
> > > slachiewicz pushed a commit to branch reportsLocation-npe
> > > in repository https://gitbox.apache.org/repos/asf/maven.git
> > > 
> > > commit 38c70be83341d8198e7f8e53a31709b2336da162
> > > Author: Sylwester Lachiewicz <sl...@apache.org>
> > > AuthorDate: Thu Apr 11 22:05:23 2019 +0200
> > > 
> > >     Fix reports Location NPE
> > > 
> > > ---
> > > 
> > >  .../apache/maven/model/plugin/DefaultReportingConverter.java   | 10
> > > 
> > > +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
> > > 
> > > diff --git
> > 
> > a/maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultR
> > e
> > 
> > > portingConverter.java
> > 
> > b/maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultR
> > e
> > 
> > > portingConverter.java index 683f494..2571104 100644
> > > ---
> > 
> > a/maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultR
> > e
> > 
> > > portingConverter.java +++
> > 
> > b/maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultR
> > e
> > 
> > > portingConverter.java @@ -235,12 +235,16 @@ public class
> > > DefaultReportingConverter
> > > 
> > >          if ( !reportSet.getReports().isEmpty() )
> > >          {
> > > 
> > > -            InputLocation location = reportSet.getLocation( "reports"
> > > );
> > > -            Xpp3Dom reports = new Xpp3Dom( "reports", location );
> > > +            InputLocation reportsLocation = reportSet.getLocation(
> > > "reports" ); +            if ( reportsLocation == null )
> > > +            {
> > > +                reportsLocation = location;
> > > +            }
> > > +            Xpp3Dom reports = new Xpp3Dom( "reports", reportsLocation
> > > );
> > > 
> > >              int n = 0;
> > >              for ( String report : reportSet.getReports() )
> > >              {
> > > 
> > > -                addDom( reports, "report", report,
> > > location.getLocation(
> > > n++ ) ); +                addDom( reports, "report", report,
> > > reportsLocation.getLocation( n++ ) ); }
> > > 
> > >              dom.addChild( reports );
> > >          
> > >          }
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> > For additional commands, e-mail: dev-help@maven.apache.org





---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: [maven] 01/01: Fix reports Location NPE

Posted by Sylwester Lachiewicz <sl...@gmail.com>.
I thought that this simple fix fixes the error, but if there is some other
reason I think you will be able to fix it better :)
Sylwester

pt., 12 kwi 2019 o 19:23 Hervé BOUTEMY <he...@free.fr> napisał(a):

> this avoid the NPE but does not fix the root cause = missing input
> location
> tracking
> see first comment of https://issues.apache.org/jira/browse/MNG-6636
>
> Do you want to try to fix the root cause?
>
> Regards,
>
> Hervé
>
> Le jeudi 11 avril 2019, 22:06:00 CEST slachiewicz@apache.org a écrit :
> > This is an automated email from the ASF dual-hosted git repository.
> >
> > slachiewicz pushed a commit to branch reportsLocation-npe
> > in repository https://gitbox.apache.org/repos/asf/maven.git
> >
> > commit 38c70be83341d8198e7f8e53a31709b2336da162
> > Author: Sylwester Lachiewicz <sl...@apache.org>
> > AuthorDate: Thu Apr 11 22:05:23 2019 +0200
> >
> >     Fix reports Location NPE
> > ---
> >  .../apache/maven/model/plugin/DefaultReportingConverter.java   | 10
> > +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
> >
> > diff --git
> >
> a/maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultRe
> > portingConverter.java
> >
> b/maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultRe
> > portingConverter.java index 683f494..2571104 100644
> > ---
> >
> a/maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultRe
> > portingConverter.java +++
> >
> b/maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultRe
> > portingConverter.java @@ -235,12 +235,16 @@ public class
> > DefaultReportingConverter
> >
> >          if ( !reportSet.getReports().isEmpty() )
> >          {
> > -            InputLocation location = reportSet.getLocation( "reports" );
> > -            Xpp3Dom reports = new Xpp3Dom( "reports", location );
> > +            InputLocation reportsLocation = reportSet.getLocation(
> > "reports" ); +            if ( reportsLocation == null )
> > +            {
> > +                reportsLocation = location;
> > +            }
> > +            Xpp3Dom reports = new Xpp3Dom( "reports", reportsLocation );
> >              int n = 0;
> >              for ( String report : reportSet.getReports() )
> >              {
> > -                addDom( reports, "report", report, location.getLocation(
> > n++ ) ); +                addDom( reports, "report", report,
> > reportsLocation.getLocation( n++ ) ); }
> >              dom.addChild( reports );
> >          }
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>