Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-6053

Unsafe System Properties copy in MavenRepositorySystemUtils, causing NPEs

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.3.9
    • Fix Version/s: 3.5.0-alpha-1, 3.5.0
    • Component/s: None
    • Labels:
      None
    • Environment:
      Eclipse m2e 1.7

      Description

      This bug has been reported in m2e https://bugs.eclipse.org/bugs/show_bug.cgi?id=493871:

      I'm occasionally, not 100% reliably reproducible, but regularly enough (like it occurs every now and then, not just once) seeing the error below, in the Error Log of Eclipse during workspace rebuilds. This is with M2E 1.7.0. – I'm not sure if this is just "annoying" or actually prevents M2E from correctly configuring projects . Either way, perhaps it would be possible to "harden" respective code to prevent this?

      java.lang.NullPointerException
      at java.util.Hashtable.put(Hashtable.java:459)
      at org.apache.maven.repository.internal.MavenRepositorySystemUtils.newSession(MavenRepositorySystemUtils.java:133)
      at org.apache.maven.internal.aether.DefaultRepositorySystemSessionFactory.newRepositorySession(DefaultRepositorySystemSessionFactory.java:98)
      at org.apache.maven.DefaultMaven.newRepositorySession(DefaultMaven.java:352)
      at org.eclipse.m2e.core.internal.embedder.MavenImpl.createRepositorySession(MavenImpl.java:309)

      Looking at https://github.com/apache/maven/blob/86b656167923923e2e416def4a48303b4e6248fa/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenRepositorySystemUtils.java#L132, it seems some system property is null (maybe due to some concurrency issue), and given that Hashtable doesn't support null values, then it throws an NPE on the put() call

        Issue Links

          Activity

          Hide
          githubbot ASF GitHub Bot added a comment -

          GitHub user fbricon opened a pull request:

          https://github.com/apache/maven/pull/90

          MNG-6053 prevent NPE when copying System Properties in MavenRepositorySystemUtils

          Added a Null check when copying System Properties in MavenRepositorySystemUtils.newSession().
          Many NPEs were reported when using Maven in Eclipse[1]. The error is most probably caused by some concurrency issue.

          [1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=493871

          Signed-off-by: Fred Bricon <fbricon@gmail.com>

          You can merge this pull request into a Git repository by running:

          $ git pull https://github.com/fbricon/maven MNG-6053

          Alternatively you can review and apply these changes as the patch at:

          https://github.com/apache/maven/pull/90.patch

          To close this pull request, make a commit to your master/trunk branch
          with (at least) the following in the commit message:

          This closes #90


          commit 57c846618cbc5c44d7f7b011f8ce7580486045bb
          Author: Fred Bricon <fbricon@gmail.com>
          Date: 2016-07-25T17:15:30Z

          MNG-6053 prevent NPE when copying System Properties in MavenRepositorySystemUtils

          Signed-off-by: Fred Bricon <fbricon@gmail.com>


          Show
          githubbot ASF GitHub Bot added a comment - GitHub user fbricon opened a pull request: https://github.com/apache/maven/pull/90 MNG-6053 prevent NPE when copying System Properties in MavenRepositorySystemUtils Added a Null check when copying System Properties in MavenRepositorySystemUtils.newSession(). Many NPEs were reported when using Maven in Eclipse [1] . The error is most probably caused by some concurrency issue. [1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=493871 Signed-off-by: Fred Bricon <fbricon@gmail.com> You can merge this pull request into a Git repository by running: $ git pull https://github.com/fbricon/maven MNG-6053 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/maven/pull/90.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #90 commit 57c846618cbc5c44d7f7b011f8ce7580486045bb Author: Fred Bricon <fbricon@gmail.com> Date: 2016-07-25T17:15:30Z MNG-6053 prevent NPE when copying System Properties in MavenRepositorySystemUtils Signed-off-by: Fred Bricon <fbricon@gmail.com>
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user asfgit closed the pull request at:

          https://github.com/apache/maven/pull/90

          Show
          githubbot ASF GitHub Bot added a comment - Github user asfgit closed the pull request at: https://github.com/apache/maven/pull/90
          Hide
          hudson Hudson added a comment -

          SUCCESS: Integrated in maven-3.x #1342 (See https://builds.apache.org/job/maven-3.x/1342/)
          MNG-6053 prevent NPE when copying System Properties in (schulte: rev 3d111735310c4630d6e805ca8cd3916afcf66802)

          • maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenRepositorySystemUtils.java
            MNG-5670 guard against ConcurrentModificationException MNG-6053 (schulte: rev f848bc20f90ff25f5585f3f9515de65dfe12779a)
          • maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenRepositorySystemUtils.java
          Show
          hudson Hudson added a comment - SUCCESS: Integrated in maven-3.x #1342 (See https://builds.apache.org/job/maven-3.x/1342/ ) MNG-6053 prevent NPE when copying System Properties in (schulte: rev 3d111735310c4630d6e805ca8cd3916afcf66802) maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenRepositorySystemUtils.java MNG-5670 guard against ConcurrentModificationException MNG-6053 (schulte: rev f848bc20f90ff25f5585f3f9515de65dfe12779a) maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenRepositorySystemUtils.java
          Hide
          hudson Hudson added a comment -

          SUCCESS: Integrated in maven-3.x #1344 (See https://builds.apache.org/job/maven-3.x/1344/)
          MNG-5670 guard against ConcurrentModificationException MNG-6053 (schulte: rev 53077505a7e9408565ec30a43ad243c41189a94e)

          • maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenRepositorySystemUtils.java
          Show
          hudson Hudson added a comment - SUCCESS: Integrated in maven-3.x #1344 (See https://builds.apache.org/job/maven-3.x/1344/ ) MNG-5670 guard against ConcurrentModificationException MNG-6053 (schulte: rev 53077505a7e9408565ec30a43ad243c41189a94e) maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenRepositorySystemUtils.java
          Hide
          stephenc Stephen Connolly added a comment -

          Maven 3.4.0 has been dropped. See this thread for more details.

          This issue will need to be re-scheduled for a Maven release in the (hopefully near) future.

          Show
          stephenc Stephen Connolly added a comment - Maven 3.4.0 has been dropped. See this thread for more details. This issue will need to be re-scheduled for a Maven release in the (hopefully near) future.
          Hide
          gboue Guillaume Boué added a comment -

          The changes applied in this issue were revisited in MNG-6105, and need not to be reapplied.

          Show
          gboue Guillaume Boué added a comment - The changes applied in this issue were revisited in MNG-6105 , and need not to be reapplied.

            People

            • Assignee:
              gboue Guillaume Boué
              Reporter:
              fbricon Fred Bricon
            • Votes:
              1 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development