Uploaded image for project: 'Maven Wagon'
  1. Maven Wagon
  2. WAGON-449

CLIENT not changed after setting PoolingHttpClientConnectionManager

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.8, 2.9, 2.10
    • Fix Version/s: 2.12
    • Component/s: wagon-http
    • Labels:
      None

      Description

      The AbstractHttpClientWagon class statically creates both a PoolingHttpClientConnectionManager and a client that uses said connection manager. This is fine, had it not been the case that the client itself is a final field and is never updated.

      Thus, using setPoolingHttpClientConnectionManager has no effect as the client is based on the PoolingHttpClientConnectionManager created at startup. This affects users that e.g. may want to change the SSLContext to support self-signed certificates.

        Activity

        Hide
        githubbot ASF GitHub Bot added a comment -

        GitHub user hyPiRion opened a pull request:

        https://github.com/apache/maven-wagon/pull/21

        WAGON-449 Recreate http-wagon client when connection manager is changed

        Hi there,

        This is a fix for the bug report WAGON-449(https://issues.apache.org/jira/browse/WAGON-449). It changes the CLIENT field to a nonfinal field so that it can be updated, and then recreates it whenever `setPoolingHttpClientConnectionManager` is set. This means that the new client will actually be generated from the newly set connection manager.

        As this this includes setting CLIENT to a nonfinal field, its name is changed to httpClient to satisfy naming conventions.

        I have tried to make this pull request as close to what seems to be the convention this project uses, but I may have missed things as I am not mainly a Java programmer nor uses Maven extensively. Please feel free to mention anything that I may have missed or would make it easier for you folks to apply this patch.

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

        $ git pull https://github.com/hyPiRion/maven-wagon WAGON-449

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

        https://github.com/apache/maven-wagon/pull/21.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 #21


        commit 4f42503a9aa6d6c03bfdf2562cb86eec194b70dd
        Author: Jean Niklas L'orange <jeannikl@hypirion.com>
        Date: 2016-01-21T23:48:17Z

        WAGON-449 Use new connection manager when set

        Recreate the http-wagon CLIENT after calling
        setPoolingHttpClientConnectionManager.

        This also includes setting CLIENT to a nonfinal field, and as a result
        its name is changed to httpClient to satisfy naming conventions.


        Show
        githubbot ASF GitHub Bot added a comment - GitHub user hyPiRion opened a pull request: https://github.com/apache/maven-wagon/pull/21 WAGON-449 Recreate http-wagon client when connection manager is changed Hi there, This is a fix for the bug report WAGON-449 ( https://issues.apache.org/jira/browse/WAGON-449 ). It changes the CLIENT field to a nonfinal field so that it can be updated, and then recreates it whenever `setPoolingHttpClientConnectionManager` is set. This means that the new client will actually be generated from the newly set connection manager. As this this includes setting CLIENT to a nonfinal field, its name is changed to httpClient to satisfy naming conventions. I have tried to make this pull request as close to what seems to be the convention this project uses, but I may have missed things as I am not mainly a Java programmer nor uses Maven extensively. Please feel free to mention anything that I may have missed or would make it easier for you folks to apply this patch. You can merge this pull request into a Git repository by running: $ git pull https://github.com/hyPiRion/maven-wagon WAGON-449 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/maven-wagon/pull/21.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 #21 commit 4f42503a9aa6d6c03bfdf2562cb86eec194b70dd Author: Jean Niklas L'orange <jeannikl@hypirion.com> Date: 2016-01-21T23:48:17Z WAGON-449 Use new connection manager when set Recreate the http-wagon CLIENT after calling setPoolingHttpClientConnectionManager. This also includes setting CLIENT to a nonfinal field, and as a result its name is changed to httpClient to satisfy naming conventions.
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user asfgit closed the pull request at:

        https://github.com/apache/maven-wagon/pull/21

        Show
        githubbot ASF GitHub Bot added a comment - Github user asfgit closed the pull request at: https://github.com/apache/maven-wagon/pull/21
        Hide
        olamy Olivier Lamy (*$^¨%`£) added a comment -

        pr merged
        Thanks!

        Show
        olamy Olivier Lamy (*$^¨%`£) added a comment - pr merged Thanks!
        Hide
        hudson Hudson added a comment -

        UNSTABLE: Integrated in maven-wagon #1302 (See https://builds.apache.org/job/maven-wagon/1302/)
        WAGON-449 Use new connection manager when set (jeannikl: rev 4f42503a9aa6d6c03bfdf2562cb86eec194b70dd)

        • wagon-providers/wagon-http/src/main/java/org/apache/maven/wagon/providers/http/AbstractHttpClientWagon.java
        • pom.xml
        Show
        hudson Hudson added a comment - UNSTABLE: Integrated in maven-wagon #1302 (See https://builds.apache.org/job/maven-wagon/1302/ ) WAGON-449 Use new connection manager when set (jeannikl: rev 4f42503a9aa6d6c03bfdf2562cb86eec194b70dd) wagon-providers/wagon-http/src/main/java/org/apache/maven/wagon/providers/http/AbstractHttpClientWagon.java pom.xml

          People

          • Assignee:
            olamy Olivier Lamy (*$^¨%`£)
            Reporter:
            jeannikl@hypirion.com Jean Niklas L'orange
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development