[GitHub] rmannibucau commented on a change in pull request #37: making the retry handle of http client configurable
rmannibucau commented on a change in pull request #37: making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211188188 ## File path: wagon-providers/wagon-http-shared/src/main/java/org/apache/maven/wagon/shared/http/AbstractHttpClientWagon.java ## @@ -354,6 +366,97 @@ private static PoolingHttpClientConnectionManager createConnManager() return connManager; } +/** + * The type of the retry handler, default to DefaultHttpRequestRetryHandler. + * Values can be default, standard (StandardHttpRequestRetryHandler), or a fully qualified name class. + * + * @since 3.0.1 + */ +private static final String RETRY_HANDLER_CLASS = +System.getProperty( "maven.wagon.http.retryhandler.class", "auto" ); + +/** + * true if it's OK to retry non-idempotent requests that have been sent. + * Note: only used for default and standard retry handlers. + * + * @since 3.0.1 + */ +private static final boolean RETRY_HANDLER_REQUEST_SENT_ENABLED = +Boolean.getBoolean( "maven.wagon.http.retryhandler.requestSentEnabled" ); + +/** + * Number of retries for the retry handler. + * Note: only used for default and standard retry handlers. + * + * @since 3.0.1 + */ +private static final int RETRY_HANDLER_COUNT = +Integer.getInteger( "maven.wagon.http.retryhandler.count", 3 ); + +private static final String DEFAULT_NON_RETRYABLE_CLASSES = +InterruptedIOException.class.getName() + "," ++ UnknownHostException.class.getName() + "," ++ ConnectException.class.getName() + "," ++ SSLException.class.getName(); +/** + * Comma separated list of non retryable classes. + * Note: only used for default retry handler. + * + * @since 3.0.1 + */ +private static final String RETRY_HANDLER_EXCEPTIONS = +System.getProperty( "maven.wagon.http.retryhandler.nonRetryableClasses", DEFAULT_NON_RETRYABLE_CLASSES ); + +private static HttpRequestRetryHandler createRetryHandler() +{ +switch ( RETRY_HANDLER_CLASS ) +{ +case "default": +if ( DEFAULT_NON_RETRYABLE_CLASSES.equals( RETRY_HANDLER_EXCEPTIONS ) ) +{ +return new DefaultHttpRequestRetryHandler( +RETRY_HANDLER_COUNT, RETRY_HANDLER_REQUEST_SENT_ENABLED ); +} +return new DefaultHttpRequestRetryHandler( +RETRY_HANDLER_COUNT, RETRY_HANDLER_REQUEST_SENT_ENABLED, getNonRetryableExceptions() ) +{ +}; +case "standard": +return new StandardHttpRequestRetryHandler( RETRY_HANDLER_COUNT, RETRY_HANDLER_REQUEST_SENT_ENABLED ); +case "auto": Review comment: changing to standard This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] rmannibucau commented on a change in pull request #37: making the retry handle of http client configurable
rmannibucau commented on a change in pull request #37: making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211188374 ## File path: wagon-providers/wagon-http-shared/src/main/java/org/apache/maven/wagon/shared/http/AbstractHttpClientWagon.java ## @@ -354,6 +366,97 @@ private static PoolingHttpClientConnectionManager createConnManager() return connManager; } +/** + * The type of the retry handler, default to DefaultHttpRequestRetryHandler. + * Values can be default, standard (StandardHttpRequestRetryHandler), or a fully qualified name class. + * + * @since 3.0.1 + */ +private static final String RETRY_HANDLER_CLASS = +System.getProperty( "maven.wagon.http.retryhandler.class", "auto" ); + +/** + * true if it's OK to retry non-idempotent requests that have been sent. + * Note: only used for default and standard retry handlers. + * + * @since 3.0.1 + */ +private static final boolean RETRY_HANDLER_REQUEST_SENT_ENABLED = +Boolean.getBoolean( "maven.wagon.http.retryhandler.requestSentEnabled" ); + +/** + * Number of retries for the retry handler. + * Note: only used for default and standard retry handlers. + * + * @since 3.0.1 + */ +private static final int RETRY_HANDLER_COUNT = +Integer.getInteger( "maven.wagon.http.retryhandler.count", 3 ); + +private static final String DEFAULT_NON_RETRYABLE_CLASSES = Review comment: we use it to fallback on the default, alternative is a toggle (boolean) but is less explicit IMHO This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] rmannibucau commented on a change in pull request #37: making the retry handle of http client configurable
rmannibucau commented on a change in pull request #37: making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211188463 ## File path: wagon-providers/wagon-http-shared/src/main/java/org/apache/maven/wagon/shared/http/AbstractHttpClientWagon.java ## @@ -354,6 +366,97 @@ private static PoolingHttpClientConnectionManager createConnManager() return connManager; } +/** + * The type of the retry handler, default to DefaultHttpRequestRetryHandler. + * Values can be default, standard (StandardHttpRequestRetryHandler), or a fully qualified name class. + * + * @since 3.0.1 + */ +private static final String RETRY_HANDLER_CLASS = +System.getProperty( "maven.wagon.http.retryhandler.class", "auto" ); + +/** + * true if it's OK to retry non-idempotent requests that have been sent. + * Note: only used for default and standard retry handlers. + * + * @since 3.0.1 + */ +private static final boolean RETRY_HANDLER_REQUEST_SENT_ENABLED = +Boolean.getBoolean( "maven.wagon.http.retryhandler.requestSentEnabled" ); + +/** + * Number of retries for the retry handler. + * Note: only used for default and standard retry handlers. + * + * @since 3.0.1 + */ +private static final int RETRY_HANDLER_COUNT = +Integer.getInteger( "maven.wagon.http.retryhandler.count", 3 ); + +private static final String DEFAULT_NON_RETRYABLE_CLASSES = +InterruptedIOException.class.getName() + "," ++ UnknownHostException.class.getName() + "," ++ ConnectException.class.getName() + "," ++ SSLException.class.getName(); +/** + * Comma separated list of non retryable classes. + * Note: only used for default retry handler. + * + * @since 3.0.1 + */ +private static final String RETRY_HANDLER_EXCEPTIONS = +System.getProperty( "maven.wagon.http.retryhandler.nonRetryableClasses", DEFAULT_NON_RETRYABLE_CLASSES ); + +private static HttpRequestRetryHandler createRetryHandler() +{ +switch ( RETRY_HANDLER_CLASS ) +{ +case "default": +if ( DEFAULT_NON_RETRYABLE_CLASSES.equals( RETRY_HANDLER_EXCEPTIONS ) ) +{ +return new DefaultHttpRequestRetryHandler( +RETRY_HANDLER_COUNT, RETRY_HANDLER_REQUEST_SENT_ENABLED ); +} +return new DefaultHttpRequestRetryHandler( Review comment: changed the default so guess it is ok now This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] rmannibucau commented on a change in pull request #37: making the retry handle of http client configurable
rmannibucau commented on a change in pull request #37: making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211188580 ## File path: wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/AbstractHttpClientWagonTest.java ## @@ -51,4 +79,197 @@ public void test() wagon.disconnect(); } + +@Test +public void retryableConfigurationDefaultTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +final HttpRequestRetryHandler handler = getCurrentHttpClient(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationCountTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.count", "5" ); + +final HttpRequestRetryHandler handler = getCurrentHttpClient(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 5, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationSentTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.requestSentEnabled", "true" ); + +final HttpRequestRetryHandler handler = getCurrentHttpClient(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertTrue( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationExceptionsTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.nonRetryableClasses", IOException.class.getName() ); + +final HttpRequestRetryHandler handler = getCurrentHttpClient(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); + +try +{ +final Field nonRetriableClasses = handler.getClass().getSuperclass() +.getDeclaredField( "nonRetriableClasses" ); +if (!nonRetriableClasses.isAccessible()) Review comment: If modules are opened I think so This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] rmannibucau commented on issue #37: making the retry handle of http client configurable
rmannibucau commented on issue #37: making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#issuecomment-414248235 Updated the PR accordingly the comments, let me know if it is better this way for you This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] michael-o commented on a change in pull request #37: making the retry handle of http client configurable
michael-o commented on a change in pull request #37: making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211196108 ## File path: wagon-providers/wagon-http/src/site/apt/index.apt ## @@ -57,3 +57,22 @@ Features * <<>> = true/false (default false), ignore issues with certificate dates. * <<>> = time in ms (default 180), read time out. + + [] + + Since version 3.0.1, the retry handler can be configured as well with system properties: + + * <<>> supports this set of values: + +* which implementation to use. `auto` will use `DefaultHttpRequestRetryHandler.INSTANCE`. Review comment: Isn't auto gone? This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] michael-o commented on a change in pull request #37: making the retry handle of http client configurable
michael-o commented on a change in pull request #37: making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211196349 ## File path: wagon-providers/wagon-http/src/site/apt/index.apt ## @@ -57,3 +57,22 @@ Features * <<>> = true/false (default false), ignore issues with certificate dates. * <<>> = time in ms (default 180), read time out. + + [] + + Since version 3.0.1, the retry handler can be configured as well with system properties: + + * <<>> supports this set of values: + +* which implementation to use. `auto` will use `DefaultHttpRequestRetryHandler.INSTANCE`. +* `default` will use a new instance of `DefaultHttpRequestRetryHandler` respecting `requestSentEnabled`, `count` and `nonRetryableClasses`. +* `standard` will use an instance of `StandardHttpRequestRetryHandler` (see https://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/org/apache/http/impl/client/StandardHttpRequestRetryHandler.html). +* Any fully qualified name of a `HttpRequestRetryHandler` implementation will be instantiated with its default constructor. + + * <<>> = `requestSentEnabled` for `default` or `standard` implementations. + + * <<>> = number of retries for `default` or `standard` implementations. + + * <<>> = the comma separated list of classes bypassing the retries (only the `default` implementation). + Default being `java.io.InterruptedIOException,java.io.UnknownHostException,java.io.ConnectException,java.io.SSLException` Review comment: There is no default anymore provided by us. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] michael-o commented on a change in pull request #37: making the retry handle of http client configurable
michael-o commented on a change in pull request #37: making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211196048 ## File path: wagon-providers/wagon-http/src/site/apt/index.apt ## @@ -57,3 +57,22 @@ Features * <<>> = true/false (default false), ignore issues with certificate dates. * <<>> = time in ms (default 180), read time out. + + [] + + Since version 3.0.1, the retry handler can be configured as well with system properties: Review comment: Version seems wrong This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] rmannibucau commented on a change in pull request #37: making the retry handle of http client configurable
rmannibucau commented on a change in pull request #37: making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211240505 ## File path: wagon-providers/wagon-http/src/site/apt/index.apt ## @@ -57,3 +57,22 @@ Features * <<>> = true/false (default false), ignore issues with certificate dates. * <<>> = time in ms (default 180), read time out. + + [] + + Since version 3.0.1, the retry handler can be configured as well with system properties: + + * <<>> supports this set of values: + +* which implementation to use. `auto` will use `DefaultHttpRequestRetryHandler.INSTANCE`. +* `default` will use a new instance of `DefaultHttpRequestRetryHandler` respecting `requestSentEnabled`, `count` and `nonRetryableClasses`. +* `standard` will use an instance of `StandardHttpRequestRetryHandler` (see https://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/org/apache/http/impl/client/StandardHttpRequestRetryHandler.html). +* Any fully qualified name of a `HttpRequestRetryHandler` implementation will be instantiated with its default constructor. + + * <<>> = `requestSentEnabled` for `default` or `standard` implementations. + + * <<>> = number of retries for `default` or `standard` implementations. + + * <<>> = the comma separated list of classes bypassing the retries (only the `default` implementation). + Default being `java.io.InterruptedIOException,java.io.UnknownHostException,java.io.ConnectException,java.io.SSLException` Review comment: fixed This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] michael-o commented on issue #37: making the retry handle of http client configurable
michael-o commented on issue #37: making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#issuecomment-414298245 Waiting for all spots to be resolved and a JIRA issue. Will then review, test and merge. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[jira] [Created] (WAGON-526) making the retry handle of http client configurable
Romain Manni-Bucau created WAGON-526: Summary: making the retry handle of http client configurable Key: WAGON-526 URL: https://issues.apache.org/jira/browse/WAGON-526 Project: Maven Wagon Issue Type: New Feature Reporter: Romain Manni-Bucau Provide a way to customize a lot (until a custom impl) the way wagon retries downloads. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[GitHub] rmannibucau commented on issue #37: [WAGON-526] making the retry handle of http client configurable
rmannibucau commented on issue #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#issuecomment-414304976 @michael-o added a jira, think I adressed the issues, please let me know if I missed some This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[jira] [Commented] (WAGON-526) making the retry handle of http client configurable
[ https://issues.apache.org/jira/browse/WAGON-526?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16585875#comment-16585875 ] ASF GitHub Bot commented on WAGON-526: -- rmannibucau commented on issue #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#issuecomment-414304976 @michael-o added a jira, think I adressed the issues, please let me know if I missed some This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > making the retry handle of http client configurable > --- > > Key: WAGON-526 > URL: https://issues.apache.org/jira/browse/WAGON-526 > Project: Maven Wagon > Issue Type: New Feature >Reporter: Romain Manni-Bucau >Priority: Major > > Provide a way to customize a lot (until a custom impl) the way wagon retries > downloads. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[GitHub] michael-o commented on issue #37: [WAGON-526] making the retry handle of http client configurable
michael-o commented on issue #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#issuecomment-414310120 You completely missed my review request: > I am still not convinced by stanard/default. From user perspective we have default and standard, what? Isn't it the same? What we have to provide has to be idiotsafe, idempotent. I currently trying to figure out what the benefit of the default is and if whether standard will cover 95% of all cases. The user still can provide a custom implementation. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[jira] [Commented] (WAGON-526) making the retry handle of http client configurable
[ https://issues.apache.org/jira/browse/WAGON-526?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16585903#comment-16585903 ] ASF GitHub Bot commented on WAGON-526: -- michael-o commented on issue #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#issuecomment-414310120 You completely missed my review request: > I am still not convinced by stanard/default. From user perspective we have default and standard, what? Isn't it the same? What we have to provide has to be idiotsafe, idempotent. I currently trying to figure out what the benefit of the default is and if whether standard will cover 95% of all cases. The user still can provide a custom implementation. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > making the retry handle of http client configurable > --- > > Key: WAGON-526 > URL: https://issues.apache.org/jira/browse/WAGON-526 > Project: Maven Wagon > Issue Type: New Feature >Reporter: Romain Manni-Bucau >Priority: Major > > Provide a way to customize a lot (until a custom impl) the way wagon retries > downloads. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Created] (MPIR-375) add plugin excludes feature
Hervé Boutemy created MPIR-375: -- Summary: add plugin excludes feature Key: MPIR-375 URL: https://issues.apache.org/jira/browse/MPIR-375 Project: Maven Project Info Reports Plugin Issue Type: New Feature Components: dependency-management Affects Versions: 3.0.0 Reporter: Hervé Boutemy M2E has a trick to disable warnings when some plugins are not supported by M2E: by configuring a fake org.eclipse.m2e:lifecycle-mapping plugin in pluginManagement, M2E detects and gets the configuration while nothing is executed during Maven build But during reporting, this fake/inexistent plugin is downloaded and an annoying failure is shown as error: {noformat}[INFO] Generating "Plugin Management" report --- maven-project-info-reports-plugin:3.0.0:plugin-management [INFO] Could not build project for: lifecycle-mapping:Error resolving project artifact: Failure to find org.eclipse.m2e:lifecycle-mapping:pom:1.0.0 in https://repo.maven.apache.org/maven2/ was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced for project org.eclipse.m2e:lifecycle-mapping:pom:1.0.0{noformat} with 3 level of nested stacktrace (not shown here for brevity) it would be useful to be able to exclude this fake plugin from the MPIR report, then avoid this nasty error -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Updated] (MPIR-375) add plugin excludes feature
[ https://issues.apache.org/jira/browse/MPIR-375?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Hervé Boutemy updated MPIR-375: --- Component/s: (was: dependency-management) plugin-management > add plugin excludes feature > --- > > Key: MPIR-375 > URL: https://issues.apache.org/jira/browse/MPIR-375 > Project: Maven Project Info Reports Plugin > Issue Type: New Feature > Components: plugin-management >Affects Versions: 3.0.0 >Reporter: Hervé Boutemy >Priority: Major > > M2E has a trick to disable warnings when some plugins are not supported by > M2E: by configuring a fake org.eclipse.m2e:lifecycle-mapping plugin in > pluginManagement, M2E detects and gets the configuration while nothing is > executed during Maven build > But during reporting, this fake/inexistent plugin is downloaded and an > annoying failure is shown as error: > {noformat}[INFO] Generating "Plugin Management" report --- > maven-project-info-reports-plugin:3.0.0:plugin-management > [INFO] Could not build project for: lifecycle-mapping:Error resolving project > artifact: Failure to find org.eclipse.m2e:lifecycle-mapping:pom:1.0.0 in > https://repo.maven.apache.org/maven2/ was cached in the local repository, > resolution will not be reattempted until the update interval of central has > elapsed or updates are forced for project > org.eclipse.m2e:lifecycle-mapping:pom:1.0.0{noformat} > with 3 level of nested stacktrace (not shown here for brevity) > it would be useful to be able to exclude this fake plugin from the MPIR > report, then avoid this nasty error -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Updated] (MPIR-375) add plugin excludes feature for plugin-management report
[ https://issues.apache.org/jira/browse/MPIR-375?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Hervé Boutemy updated MPIR-375: --- Summary: add plugin excludes feature for plugin-management report (was: add plugin excludes feature) > add plugin excludes feature for plugin-management report > > > Key: MPIR-375 > URL: https://issues.apache.org/jira/browse/MPIR-375 > Project: Maven Project Info Reports Plugin > Issue Type: New Feature > Components: plugin-management >Affects Versions: 3.0.0 >Reporter: Hervé Boutemy >Priority: Major > > M2E has a trick to disable warnings when some plugins are not supported by > M2E: by configuring a fake org.eclipse.m2e:lifecycle-mapping plugin in > pluginManagement, M2E detects and gets the configuration while nothing is > executed during Maven build > But during reporting, this fake/inexistent plugin is downloaded and an > annoying failure is shown as error: > {noformat}[INFO] Generating "Plugin Management" report --- > maven-project-info-reports-plugin:3.0.0:plugin-management > [INFO] Could not build project for: lifecycle-mapping:Error resolving project > artifact: Failure to find org.eclipse.m2e:lifecycle-mapping:pom:1.0.0 in > https://repo.maven.apache.org/maven2/ was cached in the local repository, > resolution will not be reattempted until the update interval of central has > elapsed or updates are forced for project > org.eclipse.m2e:lifecycle-mapping:pom:1.0.0{noformat} > with 3 level of nested stacktrace (not shown here for brevity) > it would be useful to be able to exclude this fake plugin from the MPIR > report, then avoid this nasty error -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Updated] (MPIR-375) add plugin excludes feature for plugin-management report
[ https://issues.apache.org/jira/browse/MPIR-375?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Hervé Boutemy updated MPIR-375: --- Description: M2E has a trick to disable warnings when some plugins are not supported by M2E: by configuring a fake org.eclipse.m2e:lifecycle-mapping plugin in pluginManagement, M2E detects and gets the configuration while nothing is executed during Maven build (see http://www.eclipse.org/m2e/documentation/m2e-execution-not-covered.html#ignore-plugin-goal) But during reporting, this fake/inexistent plugin is downloaded and an annoying failure is shown as error: {noformat}[INFO] Generating "Plugin Management" report --- maven-project-info-reports-plugin:3.0.0:plugin-management [INFO] Could not build project for: lifecycle-mapping:Error resolving project artifact: Failure to find org.eclipse.m2e:lifecycle-mapping:pom:1.0.0 in https://repo.maven.apache.org/maven2/ was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced for project org.eclipse.m2e:lifecycle-mapping:pom:1.0.0{noformat} with 3 level of nested stacktrace (not shown here for brevity) it would be useful to be able to exclude this fake plugin from the MPIR report, then avoid this nasty error was: M2E has a trick to disable warnings when some plugins are not supported by M2E: by configuring a fake org.eclipse.m2e:lifecycle-mapping plugin in pluginManagement, M2E detects and gets the configuration while nothing is executed during Maven build But during reporting, this fake/inexistent plugin is downloaded and an annoying failure is shown as error: {noformat}[INFO] Generating "Plugin Management" report --- maven-project-info-reports-plugin:3.0.0:plugin-management [INFO] Could not build project for: lifecycle-mapping:Error resolving project artifact: Failure to find org.eclipse.m2e:lifecycle-mapping:pom:1.0.0 in https://repo.maven.apache.org/maven2/ was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced for project org.eclipse.m2e:lifecycle-mapping:pom:1.0.0{noformat} with 3 level of nested stacktrace (not shown here for brevity) it would be useful to be able to exclude this fake plugin from the MPIR report, then avoid this nasty error > add plugin excludes feature for plugin-management report > > > Key: MPIR-375 > URL: https://issues.apache.org/jira/browse/MPIR-375 > Project: Maven Project Info Reports Plugin > Issue Type: New Feature > Components: plugin-management >Affects Versions: 3.0.0 >Reporter: Hervé Boutemy >Priority: Major > > M2E has a trick to disable warnings when some plugins are not supported by > M2E: by configuring a fake org.eclipse.m2e:lifecycle-mapping plugin in > pluginManagement, M2E detects and gets the configuration while nothing is > executed during Maven build (see > http://www.eclipse.org/m2e/documentation/m2e-execution-not-covered.html#ignore-plugin-goal) > But during reporting, this fake/inexistent plugin is downloaded and an > annoying failure is shown as error: > {noformat}[INFO] Generating "Plugin Management" report --- > maven-project-info-reports-plugin:3.0.0:plugin-management > [INFO] Could not build project for: lifecycle-mapping:Error resolving project > artifact: Failure to find org.eclipse.m2e:lifecycle-mapping:pom:1.0.0 in > https://repo.maven.apache.org/maven2/ was cached in the local repository, > resolution will not be reattempted until the update interval of central has > elapsed or updates are forced for project > org.eclipse.m2e:lifecycle-mapping:pom:1.0.0{noformat} > with 3 level of nested stacktrace (not shown here for brevity) > it would be useful to be able to exclude this fake plugin from the MPIR > report, then avoid this nasty error -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Updated] (MPIR-375) add plugin excludes feature for plugin-management report
[ https://issues.apache.org/jira/browse/MPIR-375?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Hervé Boutemy updated MPIR-375: --- Labels: up-for-grabs (was: for-the-grabs) > add plugin excludes feature for plugin-management report > > > Key: MPIR-375 > URL: https://issues.apache.org/jira/browse/MPIR-375 > Project: Maven Project Info Reports Plugin > Issue Type: New Feature > Components: plugin-management >Affects Versions: 3.0.0 >Reporter: Hervé Boutemy >Priority: Major > Labels: up-for-grabs > > M2E has a trick to disable warnings when some plugins are not supported by > M2E: by configuring a fake org.eclipse.m2e:lifecycle-mapping plugin in > pluginManagement, M2E detects and gets the configuration while nothing is > executed during Maven build (see > http://www.eclipse.org/m2e/documentation/m2e-execution-not-covered.html#ignore-plugin-goal) > But during reporting, this fake/inexistent plugin is downloaded and an > annoying failure is shown as error: > {noformat}[INFO] Generating "Plugin Management" report --- > maven-project-info-reports-plugin:3.0.0:plugin-management > [INFO] Could not build project for: lifecycle-mapping:Error resolving project > artifact: Failure to find org.eclipse.m2e:lifecycle-mapping:pom:1.0.0 in > https://repo.maven.apache.org/maven2/ was cached in the local repository, > resolution will not be reattempted until the update interval of central has > elapsed or updates are forced for project > org.eclipse.m2e:lifecycle-mapping:pom:1.0.0{noformat} > with 3 level of nested stacktrace (not shown here for brevity) > it would be useful to be able to exclude this fake plugin from the MPIR > report, then avoid this nasty error -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Updated] (MPIR-375) add plugin excludes feature for plugin-management report
[ https://issues.apache.org/jira/browse/MPIR-375?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Hervé Boutemy updated MPIR-375: --- Labels: for-the-grabs (was: ) > add plugin excludes feature for plugin-management report > > > Key: MPIR-375 > URL: https://issues.apache.org/jira/browse/MPIR-375 > Project: Maven Project Info Reports Plugin > Issue Type: New Feature > Components: plugin-management >Affects Versions: 3.0.0 >Reporter: Hervé Boutemy >Priority: Major > Labels: up-for-grabs > > M2E has a trick to disable warnings when some plugins are not supported by > M2E: by configuring a fake org.eclipse.m2e:lifecycle-mapping plugin in > pluginManagement, M2E detects and gets the configuration while nothing is > executed during Maven build (see > http://www.eclipse.org/m2e/documentation/m2e-execution-not-covered.html#ignore-plugin-goal) > But during reporting, this fake/inexistent plugin is downloaded and an > annoying failure is shown as error: > {noformat}[INFO] Generating "Plugin Management" report --- > maven-project-info-reports-plugin:3.0.0:plugin-management > [INFO] Could not build project for: lifecycle-mapping:Error resolving project > artifact: Failure to find org.eclipse.m2e:lifecycle-mapping:pom:1.0.0 in > https://repo.maven.apache.org/maven2/ was cached in the local repository, > resolution will not be reattempted until the update interval of central has > elapsed or updates are forced for project > org.eclipse.m2e:lifecycle-mapping:pom:1.0.0{noformat} > with 3 level of nested stacktrace (not shown here for brevity) > it would be useful to be able to exclude this fake plugin from the MPIR > report, then avoid this nasty error -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (MSHADE-292) Relocation exclude works differently on Win and Unix platforms
[ https://issues.apache.org/jira/browse/MSHADE-292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16585946#comment-16585946 ] Artem Yak commented on MSHADE-292: -- [~khmarbaise] thanks for response. Documentation is fine. What linux distributive did you use? I just checked attached project on another env: {code} $ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 16.04.5 LTS Release: 16.04 Codename: xenial {code} and with given configuration: {code:xml} com bug.com com.orange.* com.banana.* {code} final jar had files: {noformat} com/ com/orange/ com/orange/T.class bug/com/ bug/com/orange/ bug/com/orange/framework/ bug/com/orange/framework/T.class com/banana/ com/banana/T.class META-INF/maven/com.orange.qa/ META-INF/maven/com.orange.qa/BUG/ META-INF/maven/com.orange.qa/BUG/pom.xml META-INF/maven/com.orange.qa/BUG/pom.properties bug/com/google/ bug/com/google/gson/ {noformat} Problem here is the _framework_ package is not excluded. which is still different from windows (expected result). What mechanize is used to match the exclusion pattern? it looks like it highly OS dependent. > Relocation exclude works differently on Win and Unix platforms > -- > > Key: MSHADE-292 > URL: https://issues.apache.org/jira/browse/MSHADE-292 > Project: Maven Shade Plugin > Issue Type: Bug >Affects Versions: 3.1.1 >Reporter: Artem Yak >Priority: Major > Attachments: defect.tar.gz > > > Un-tar attached project. > execute on Windows : > {code:java} > mvn clean package -X && unzip -l target/BUG-0.1-SNAPSHOT.jar | grep com -m15 > {code} > output is: > {code:java} > 0 2018-06-25 15:36com/ > 0 2018-06-25 15:36com/banana/ > 250 2018-06-25 15:36 com/banana/T.class > 0 2018-06-25 15:36com/orange/ > 0 2018-06-25 15:36com/orange/framework/ > 270 2018-06-25 15:36 com/orange/framework/T.class > 250 2018-06-25 15:36 com/orange/T.class > 0 2018-06-25 15:36META-INF/maven/com.orange.qa/ > 0 2018-06-25 15:36META-INF/maven/com.orange.qa/BUG/ > 2166 2018-06-25 18:15 META-INF/maven/com.orange.qa/BUG/pom.xml > 114 2018-06-25 15:36 META-INF/maven/com.orange.qa/BUG/pom.properties > 0 2018-06-25 15:36bug/com/ > 0 2018-06-25 15:36bug/com/google/ > 0 2018-06-25 15:36bug/com/google/gson/ > 0 2018-06-25 15:36bug/com/google/gson/annotations/ > {code} > execute on Unix (CentOS or MacOS) : > {code:java} > mvn clean package -X && unzip -l target/BUG-0.1-SNAPSHOT.jar | grep com > -m15{code} > output is > {code:java} > 0 06-25-2018 18:35 bug/com/ > 0 06-25-2018 18:35 bug/com/orange/ > 0 06-25-2018 18:35 bug/com/orange/framework/ > 278 06-25-2018 18:35 bug/com/orange/framework/T.class > 0 06-25-2018 18:35 com/ > 0 06-25-2018 18:35 com/orange/ > 250 06-25-2018 18:35 com/orange/T.class > 0 06-25-2018 18:35 com/banana/ > 250 06-25-2018 18:35 com/banana/T.class > 0 06-25-2018 18:35 META-INF/maven/com.orange.qa/ > 0 06-25-2018 18:35 META-INF/maven/com.orange.qa/BUG/ > 2166 06-25-2018 18:15 META-INF/maven/com.orange.qa/BUG/pom.xml > 109 06-25-2018 18:35 META-INF/maven/com.orange.qa/BUG/pom.properties > 0 06-25-2018 18:35 bug/com/google/ > 0 06-25-2018 18:35 bug/com/google/gson/ > {code} > *Actual result:* > Relocation->exclude didn't work as expected on unix > *Expected results* is on Windows: > com/orange/framework/T must be excluded from bug.com relocations > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (MSHADE-292) Relocation exclude works differently on Win and Unix platforms
[ https://issues.apache.org/jira/browse/MSHADE-292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16585989#comment-16585989 ] Artem Yak commented on MSHADE-292: -- OK. I got a working configuration: {noformat} com bug.com com.orange.** com.banana.** {noformat} Two asterisks do exactly what I excepted on Win and Linux. > Relocation exclude works differently on Win and Unix platforms > -- > > Key: MSHADE-292 > URL: https://issues.apache.org/jira/browse/MSHADE-292 > Project: Maven Shade Plugin > Issue Type: Bug >Affects Versions: 3.1.1 >Reporter: Artem Yak >Priority: Major > Attachments: defect.tar.gz > > > Un-tar attached project. > execute on Windows : > {code:java} > mvn clean package -X && unzip -l target/BUG-0.1-SNAPSHOT.jar | grep com -m15 > {code} > output is: > {code:java} > 0 2018-06-25 15:36com/ > 0 2018-06-25 15:36com/banana/ > 250 2018-06-25 15:36 com/banana/T.class > 0 2018-06-25 15:36com/orange/ > 0 2018-06-25 15:36com/orange/framework/ > 270 2018-06-25 15:36 com/orange/framework/T.class > 250 2018-06-25 15:36 com/orange/T.class > 0 2018-06-25 15:36META-INF/maven/com.orange.qa/ > 0 2018-06-25 15:36META-INF/maven/com.orange.qa/BUG/ > 2166 2018-06-25 18:15 META-INF/maven/com.orange.qa/BUG/pom.xml > 114 2018-06-25 15:36 META-INF/maven/com.orange.qa/BUG/pom.properties > 0 2018-06-25 15:36bug/com/ > 0 2018-06-25 15:36bug/com/google/ > 0 2018-06-25 15:36bug/com/google/gson/ > 0 2018-06-25 15:36bug/com/google/gson/annotations/ > {code} > execute on Unix (CentOS or MacOS) : > {code:java} > mvn clean package -X && unzip -l target/BUG-0.1-SNAPSHOT.jar | grep com > -m15{code} > output is > {code:java} > 0 06-25-2018 18:35 bug/com/ > 0 06-25-2018 18:35 bug/com/orange/ > 0 06-25-2018 18:35 bug/com/orange/framework/ > 278 06-25-2018 18:35 bug/com/orange/framework/T.class > 0 06-25-2018 18:35 com/ > 0 06-25-2018 18:35 com/orange/ > 250 06-25-2018 18:35 com/orange/T.class > 0 06-25-2018 18:35 com/banana/ > 250 06-25-2018 18:35 com/banana/T.class > 0 06-25-2018 18:35 META-INF/maven/com.orange.qa/ > 0 06-25-2018 18:35 META-INF/maven/com.orange.qa/BUG/ > 2166 06-25-2018 18:15 META-INF/maven/com.orange.qa/BUG/pom.xml > 109 06-25-2018 18:35 META-INF/maven/com.orange.qa/BUG/pom.properties > 0 06-25-2018 18:35 bug/com/google/ > 0 06-25-2018 18:35 bug/com/google/gson/ > {code} > *Actual result:* > Relocation->exclude didn't work as expected on unix > *Expected results* is on Windows: > com/orange/framework/T must be excluded from bug.com relocations > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Updated] (MSHADE-292) Relocation exclude works differently on Win and Unix platforms
[ https://issues.apache.org/jira/browse/MSHADE-292?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Artem Yak updated MSHADE-292: - Priority: Minor (was: Major) > Relocation exclude works differently on Win and Unix platforms > -- > > Key: MSHADE-292 > URL: https://issues.apache.org/jira/browse/MSHADE-292 > Project: Maven Shade Plugin > Issue Type: Bug >Affects Versions: 3.1.1 >Reporter: Artem Yak >Priority: Minor > Attachments: defect.tar.gz > > > Un-tar attached project. > execute on Windows : > {code:java} > mvn clean package -X && unzip -l target/BUG-0.1-SNAPSHOT.jar | grep com -m15 > {code} > output is: > {code:java} > 0 2018-06-25 15:36com/ > 0 2018-06-25 15:36com/banana/ > 250 2018-06-25 15:36 com/banana/T.class > 0 2018-06-25 15:36com/orange/ > 0 2018-06-25 15:36com/orange/framework/ > 270 2018-06-25 15:36 com/orange/framework/T.class > 250 2018-06-25 15:36 com/orange/T.class > 0 2018-06-25 15:36META-INF/maven/com.orange.qa/ > 0 2018-06-25 15:36META-INF/maven/com.orange.qa/BUG/ > 2166 2018-06-25 18:15 META-INF/maven/com.orange.qa/BUG/pom.xml > 114 2018-06-25 15:36 META-INF/maven/com.orange.qa/BUG/pom.properties > 0 2018-06-25 15:36bug/com/ > 0 2018-06-25 15:36bug/com/google/ > 0 2018-06-25 15:36bug/com/google/gson/ > 0 2018-06-25 15:36bug/com/google/gson/annotations/ > {code} > execute on Unix (CentOS or MacOS) : > {code:java} > mvn clean package -X && unzip -l target/BUG-0.1-SNAPSHOT.jar | grep com > -m15{code} > output is > {code:java} > 0 06-25-2018 18:35 bug/com/ > 0 06-25-2018 18:35 bug/com/orange/ > 0 06-25-2018 18:35 bug/com/orange/framework/ > 278 06-25-2018 18:35 bug/com/orange/framework/T.class > 0 06-25-2018 18:35 com/ > 0 06-25-2018 18:35 com/orange/ > 250 06-25-2018 18:35 com/orange/T.class > 0 06-25-2018 18:35 com/banana/ > 250 06-25-2018 18:35 com/banana/T.class > 0 06-25-2018 18:35 META-INF/maven/com.orange.qa/ > 0 06-25-2018 18:35 META-INF/maven/com.orange.qa/BUG/ > 2166 06-25-2018 18:15 META-INF/maven/com.orange.qa/BUG/pom.xml > 109 06-25-2018 18:35 META-INF/maven/com.orange.qa/BUG/pom.properties > 0 06-25-2018 18:35 bug/com/google/ > 0 06-25-2018 18:35 bug/com/google/gson/ > {code} > *Actual result:* > Relocation->exclude didn't work as expected on unix > *Expected results* is on Windows: > com/orange/framework/T must be excluded from bug.com relocations > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Created] (SCM-897) French accent lost and replaced by weird characters in the changelog.xml
Jamel created SCM-897: - Summary: French accent lost and replaced by weird characters in the changelog.xml Key: SCM-897 URL: https://issues.apache.org/jira/browse/SCM-897 Project: Maven SCM Issue Type: Bug Components: maven-scm-provider-gitexe Affects Versions: 1.9.4 Environment: JDK 8, Windows 7 Reporter: Jamel Executing changelog goal of maven-changelog-plugin will result in xml file with weird characters replacing french accented characters. You have to execute maven command on french system (in my case windows 7) to get the problem. So far, I realized that a bug may be present in the scm git-exe plugin. it seems that an UTF-8 stream is read as ISO-8859-1 (Westen Europe) which lead to corrupted message. I fixed the bug by passing System.getProperty("file.encoding") to --encoding param of "git whatchanged" command. {noformat} I added this line of code: cl.createArg().setValue( "--encoding=" + System.getProperty("file.encoding")); to org.apache.maven.scm.provider.git.gitexe.command.changelog.GitChangeLogCommand.createCommandLine(){noformat} the other way is to read the command output with the right encoding (I assume UTF-8). -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCM-834) Commit encoding is platform-dependent instead of UTF-8
[ https://issues.apache.org/jira/browse/SCM-834?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16585999#comment-16585999 ] Jamel commented on SCM-834: --- Yes. Here is issue : https://issues.apache.org/jira/browse/SCM-897 > Commit encoding is platform-dependent instead of UTF-8 > -- > > Key: SCM-834 > URL: https://issues.apache.org/jira/browse/SCM-834 > Project: Maven SCM > Issue Type: Bug > Components: maven-scm-provider-gitexe, maven-scm-provider-svn >Affects Versions: 1.9.4 >Reporter: Tobias Gruetzmacher >Assignee: Michael Osipov >Priority: Blocker > Fix For: 1.10.1 > > > When doing a release with the maven-release-plugin, if you have a > non-ASCII-character in your commit message (setting scmCommentPrefix to > "lösung" for example), the resulting commit message has a different encoding > on different operating systems. If it isn't UTF-8 (on Windows, for example), > git complains with > {code} > Warning: commit message did not conform to UTF-8. > You may want to amend it after fixing the message, or set the config > variable i18n.commitencoding to the encoding your project uses. > {code} > AFAICS, the fix is pretty simple: Just add "UTF-8" to the call of fileWrite > in > [GitCheckInCommand.java|https://github.com/apache/maven-scm/blob/master/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/command/checkin/GitCheckInCommand.java#L74] -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Updated] (SCM-897) French accent lost and replaced by weird characters in the changelog.xml
[ https://issues.apache.org/jira/browse/SCM-897?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Jamel updated SCM-897: -- Description: Executing changelog goal of maven-changelog-plugin will result in xml file with weird characters replacing french accented characters. You have to execute maven command on french system (in my case windows 7) to get the problem. So far, I realized that a bug may be present in the scm git-exe plugin. it seems that an UTF-8 stream was read as ISO-8859-1 (Westen Europe) which lead to corrupted message. I fixed the bug by passing System.getProperty("file.encoding") to --encoding param of "git whatchanged" command. {noformat} I added this line of code: cl.createArg().setValue( "--encoding=" + System.getProperty("file.encoding")); to org.apache.maven.scm.provider.git.gitexe.command.changelog.GitChangeLogCommand.createCommandLine(){noformat} the other way is to read the command output with the right encoding (I assume UTF-8). was: Executing changelog goal of maven-changelog-plugin will result in xml file with weird characters replacing french accented characters. You have to execute maven command on french system (in my case windows 7) to get the problem. So far, I realized that a bug may be present in the scm git-exe plugin. it seems that an UTF-8 stream is read as ISO-8859-1 (Westen Europe) which lead to corrupted message. I fixed the bug by passing System.getProperty("file.encoding") to --encoding param of "git whatchanged" command. {noformat} I added this line of code: cl.createArg().setValue( "--encoding=" + System.getProperty("file.encoding")); to org.apache.maven.scm.provider.git.gitexe.command.changelog.GitChangeLogCommand.createCommandLine(){noformat} the other way is to read the command output with the right encoding (I assume UTF-8). > French accent lost and replaced by weird characters in the changelog.xml > > > Key: SCM-897 > URL: https://issues.apache.org/jira/browse/SCM-897 > Project: Maven SCM > Issue Type: Bug > Components: maven-scm-provider-gitexe >Affects Versions: 1.9.4 > Environment: JDK 8, Windows 7 >Reporter: Jamel >Priority: Major > > Executing changelog goal of maven-changelog-plugin will result in xml file > with weird characters replacing french accented characters. > You have to execute maven command on french system (in my case windows 7) to > get the problem. > So far, I realized that a bug may be present in the scm git-exe plugin. it > seems that an UTF-8 stream was read as ISO-8859-1 (Westen Europe) which lead > to corrupted message. > I fixed the bug by passing System.getProperty("file.encoding") to --encoding > param of "git whatchanged" command. > {noformat} > I added this line of code: > cl.createArg().setValue( "--encoding=" + System.getProperty("file.encoding")); > to > org.apache.maven.scm.provider.git.gitexe.command.changelog.GitChangeLogCommand.createCommandLine(){noformat} > the other way is to read the command output with the right encoding (I assume > UTF-8). -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Comment Edited] (SCM-834) Commit encoding is platform-dependent instead of UTF-8
[ https://issues.apache.org/jira/browse/SCM-834?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16585999#comment-16585999 ] Jamel edited comment on SCM-834 at 8/20/18 2:26 PM: Yes. Here is the issue : https://issues.apache.org/jira/browse/SCM-897 was (Author: aljane.ja...@gmail.com): Yes. Here is issue : https://issues.apache.org/jira/browse/SCM-897 > Commit encoding is platform-dependent instead of UTF-8 > -- > > Key: SCM-834 > URL: https://issues.apache.org/jira/browse/SCM-834 > Project: Maven SCM > Issue Type: Bug > Components: maven-scm-provider-gitexe, maven-scm-provider-svn >Affects Versions: 1.9.4 >Reporter: Tobias Gruetzmacher >Assignee: Michael Osipov >Priority: Blocker > Fix For: 1.10.1 > > > When doing a release with the maven-release-plugin, if you have a > non-ASCII-character in your commit message (setting scmCommentPrefix to > "lösung" for example), the resulting commit message has a different encoding > on different operating systems. If it isn't UTF-8 (on Windows, for example), > git complains with > {code} > Warning: commit message did not conform to UTF-8. > You may want to amend it after fixing the message, or set the config > variable i18n.commitencoding to the encoding your project uses. > {code} > AFAICS, the fix is pretty simple: Just add "UTF-8" to the call of fileWrite > in > [GitCheckInCommand.java|https://github.com/apache/maven-scm/blob/master/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/command/checkin/GitCheckInCommand.java#L74] -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[GitHub] rmannibucau commented on issue #37: [WAGON-526] making the retry handle of http client configurable
rmannibucau commented on issue #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#issuecomment-414336149 @michael-o oh oki. Yes it makes sense, it basically exposes the known impl of httpclient in maven and match the same use cases. Rational was to never require a custom impl in 99% of the cases cause it is quite impacting to do it compared to configuring the standard or default impls. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[jira] [Commented] (WAGON-526) making the retry handle of http client configurable
[ https://issues.apache.org/jira/browse/WAGON-526?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16586008#comment-16586008 ] ASF GitHub Bot commented on WAGON-526: -- rmannibucau commented on issue #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#issuecomment-414336149 @michael-o oh oki. Yes it makes sense, it basically exposes the known impl of httpclient in maven and match the same use cases. Rational was to never require a custom impl in 99% of the cases cause it is quite impacting to do it compared to configuring the standard or default impls. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > making the retry handle of http client configurable > --- > > Key: WAGON-526 > URL: https://issues.apache.org/jira/browse/WAGON-526 > Project: Maven Wagon > Issue Type: New Feature >Reporter: Romain Manni-Bucau >Priority: Major > > Provide a way to customize a lot (until a custom impl) the way wagon retries > downloads. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[GitHub] michael-o commented on issue #37: [WAGON-526] making the retry handle of http client configurable
michael-o commented on issue #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#issuecomment-414341589 Alright, I will have at this later this day. I think there is still room for some improvement. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] michael-o edited a comment on issue #37: [WAGON-526] making the retry handle of http client configurable
michael-o edited a comment on issue #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#issuecomment-414341589 Alright, I will have at this later this day. I think there is still room for some improvement, but I like the big picture so far. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[jira] [Commented] (WAGON-526) making the retry handle of http client configurable
[ https://issues.apache.org/jira/browse/WAGON-526?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16586032#comment-16586032 ] ASF GitHub Bot commented on WAGON-526: -- michael-o edited a comment on issue #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#issuecomment-414341589 Alright, I will have at this later this day. I think there is still room for some improvement, but I like the big picture so far. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > making the retry handle of http client configurable > --- > > Key: WAGON-526 > URL: https://issues.apache.org/jira/browse/WAGON-526 > Project: Maven Wagon > Issue Type: New Feature >Reporter: Romain Manni-Bucau >Priority: Major > > Provide a way to customize a lot (until a custom impl) the way wagon retries > downloads. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (WAGON-526) making the retry handle of http client configurable
[ https://issues.apache.org/jira/browse/WAGON-526?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16586030#comment-16586030 ] ASF GitHub Bot commented on WAGON-526: -- michael-o commented on issue #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#issuecomment-414341589 Alright, I will have at this later this day. I think there is still room for some improvement. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > making the retry handle of http client configurable > --- > > Key: WAGON-526 > URL: https://issues.apache.org/jira/browse/WAGON-526 > Project: Maven Wagon > Issue Type: New Feature >Reporter: Romain Manni-Bucau >Priority: Major > > Provide a way to customize a lot (until a custom impl) the way wagon retries > downloads. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (MCHANGES-393) Default for teamlist is wrong
[ https://issues.apache.org/jira/browse/MCHANGES-393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16586039#comment-16586039 ] Stephen Colebourne commented on MCHANGES-393: - The title of this issue could be clearer. Maybe "Broken links for team members on changes report". > Default for teamlist is wrong > - > > Key: MCHANGES-393 > URL: https://issues.apache.org/jira/browse/MCHANGES-393 > Project: Maven Changes Plugin > Issue Type: Bug > Components: changes.xml >Reporter: Joerg Schaible >Priority: Major > > It seems at some stage the PIR changed the name for the page generated for > the team list. At least with current PIR 3.0.0 generates a page _team.html_ > and the current changes report has broken links for the devs. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Created] (MENFORCER-314) DependencyConvergence fails sporadically with a null message
Falko Modler created MENFORCER-314: -- Summary: DependencyConvergence fails sporadically with a null message Key: MENFORCER-314 URL: https://issues.apache.org/jira/browse/MENFORCER-314 Project: Maven Enforcer Plugin Issue Type: Bug Components: Standard Rules Affects Versions: 1.4.1 Environment: Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T17:41:47+01:00) Java version: 1.8.0_162, vendor: Oracle Corporation Reporter: Falko Modler Our Jenkins builds fail sporadically without providing a message: {noformat} 17:08:28 [WARNING] Rule 4: org.apache.maven.plugins.enforcer.DependencyConvergence failed with message: 17:08:28 null {noformat} Looking at the code, I suspect that this can happen [on line 132 of the rule|https://github.com/apache/maven-enforcer/blob/enforcer-3.0.0-M2/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/DependencyConvergence.java#L132] when some underlying exception is caught which itself does not provide a (localized) message. As the plugin [does not include the cause|https://github.com/apache/maven-enforcer/blob/enforcer-3.0.0-M2/maven-enforcer-plugin/src/main/java/org/apache/maven/plugins/enforcer/EnforceMojo.java#L212] (unless {{failFast}} is set), you will just see a null message. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCM-897) French accent lost and replaced by weird characters in the changelog.xml
[ https://issues.apache.org/jira/browse/SCM-897?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16586191#comment-16586191 ] Michael Osipov commented on SCM-897: Can you evaluate [this|https://stackoverflow.com/questions/41139067/git-log-output-encoding-issues-on-windows-10-command-prompt]? > French accent lost and replaced by weird characters in the changelog.xml > > > Key: SCM-897 > URL: https://issues.apache.org/jira/browse/SCM-897 > Project: Maven SCM > Issue Type: Bug > Components: maven-scm-provider-gitexe >Affects Versions: 1.9.4 > Environment: JDK 8, Windows 7 >Reporter: Jamel >Priority: Major > > Executing changelog goal of maven-changelog-plugin will result in xml file > with weird characters replacing french accented characters. > You have to execute maven command on french system (in my case windows 7) to > get the problem. > So far, I realized that a bug may be present in the scm git-exe plugin. it > seems that an UTF-8 stream was read as ISO-8859-1 (Westen Europe) which lead > to corrupted message. > I fixed the bug by passing System.getProperty("file.encoding") to --encoding > param of "git whatchanged" command. > {noformat} > I added this line of code: > cl.createArg().setValue( "--encoding=" + System.getProperty("file.encoding")); > to > org.apache.maven.scm.provider.git.gitexe.command.changelog.GitChangeLogCommand.createCommandLine(){noformat} > the other way is to read the command output with the right encoding (I assume > UTF-8). -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[GitHub] jean-philippe-martin commented on issue #4: (doc) - mention include tag
jean-philippe-martin commented on issue #4: (doc) - mention include tag URL: https://github.com/apache/maven-shade-plugin/pull/4#issuecomment-414390127 Great, thank you! This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[jira] [Commented] (MSHADE-292) Relocation exclude works differently on Win and Unix platforms
[ https://issues.apache.org/jira/browse/MSHADE-292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16586234#comment-16586234 ] Karl Heinz Marbaise commented on MSHADE-292: It should also work with {{com.orange*}} ? Can you check this? > Relocation exclude works differently on Win and Unix platforms > -- > > Key: MSHADE-292 > URL: https://issues.apache.org/jira/browse/MSHADE-292 > Project: Maven Shade Plugin > Issue Type: Bug >Affects Versions: 3.1.1 >Reporter: Artem Yak >Priority: Minor > Attachments: defect.tar.gz > > > Un-tar attached project. > execute on Windows : > {code:java} > mvn clean package -X && unzip -l target/BUG-0.1-SNAPSHOT.jar | grep com -m15 > {code} > output is: > {code:java} > 0 2018-06-25 15:36com/ > 0 2018-06-25 15:36com/banana/ > 250 2018-06-25 15:36 com/banana/T.class > 0 2018-06-25 15:36com/orange/ > 0 2018-06-25 15:36com/orange/framework/ > 270 2018-06-25 15:36 com/orange/framework/T.class > 250 2018-06-25 15:36 com/orange/T.class > 0 2018-06-25 15:36META-INF/maven/com.orange.qa/ > 0 2018-06-25 15:36META-INF/maven/com.orange.qa/BUG/ > 2166 2018-06-25 18:15 META-INF/maven/com.orange.qa/BUG/pom.xml > 114 2018-06-25 15:36 META-INF/maven/com.orange.qa/BUG/pom.properties > 0 2018-06-25 15:36bug/com/ > 0 2018-06-25 15:36bug/com/google/ > 0 2018-06-25 15:36bug/com/google/gson/ > 0 2018-06-25 15:36bug/com/google/gson/annotations/ > {code} > execute on Unix (CentOS or MacOS) : > {code:java} > mvn clean package -X && unzip -l target/BUG-0.1-SNAPSHOT.jar | grep com > -m15{code} > output is > {code:java} > 0 06-25-2018 18:35 bug/com/ > 0 06-25-2018 18:35 bug/com/orange/ > 0 06-25-2018 18:35 bug/com/orange/framework/ > 278 06-25-2018 18:35 bug/com/orange/framework/T.class > 0 06-25-2018 18:35 com/ > 0 06-25-2018 18:35 com/orange/ > 250 06-25-2018 18:35 com/orange/T.class > 0 06-25-2018 18:35 com/banana/ > 250 06-25-2018 18:35 com/banana/T.class > 0 06-25-2018 18:35 META-INF/maven/com.orange.qa/ > 0 06-25-2018 18:35 META-INF/maven/com.orange.qa/BUG/ > 2166 06-25-2018 18:15 META-INF/maven/com.orange.qa/BUG/pom.xml > 109 06-25-2018 18:35 META-INF/maven/com.orange.qa/BUG/pom.properties > 0 06-25-2018 18:35 bug/com/google/ > 0 06-25-2018 18:35 bug/com/google/gson/ > {code} > *Actual result:* > Relocation->exclude didn't work as expected on unix > *Expected results* is on Windows: > com/orange/framework/T must be excluded from bug.com relocations > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (MSHADE-292) Relocation exclude works differently on Win and Unix platforms
[ https://issues.apache.org/jira/browse/MSHADE-292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16586305#comment-16586305 ] Artem Yak commented on MSHADE-292: -- {noformat} com bug.com com.orange* com.banana* {noformat} for win (works as expected) : {code:java} com/ com/banana/ com/banana/T.class com/orange/ com/orange/framework/ com/orange/framework/T.class com/orange/T.class bug/com/ bug/com/google/ bug/com/google/gson/ {code} for ubuntu (exclusion does nothing) : {code:java} bug/com/ bug/com/orange/ bug/com/orange/T.class bug/com/orange/framework/ bug/com/orange/framework/T.class bug/com/banana/ bug/com/banana/T.class bug/com/google/ bug/com/google/gson/ bug/com/google/gson/annotations/ {code} > Relocation exclude works differently on Win and Unix platforms > -- > > Key: MSHADE-292 > URL: https://issues.apache.org/jira/browse/MSHADE-292 > Project: Maven Shade Plugin > Issue Type: Bug >Affects Versions: 3.1.1 >Reporter: Artem Yak >Priority: Minor > Attachments: defect.tar.gz > > > Un-tar attached project. > execute on Windows : > {code:java} > mvn clean package -X && unzip -l target/BUG-0.1-SNAPSHOT.jar | grep com -m15 > {code} > output is: > {code:java} > 0 2018-06-25 15:36com/ > 0 2018-06-25 15:36com/banana/ > 250 2018-06-25 15:36 com/banana/T.class > 0 2018-06-25 15:36com/orange/ > 0 2018-06-25 15:36com/orange/framework/ > 270 2018-06-25 15:36 com/orange/framework/T.class > 250 2018-06-25 15:36 com/orange/T.class > 0 2018-06-25 15:36META-INF/maven/com.orange.qa/ > 0 2018-06-25 15:36META-INF/maven/com.orange.qa/BUG/ > 2166 2018-06-25 18:15 META-INF/maven/com.orange.qa/BUG/pom.xml > 114 2018-06-25 15:36 META-INF/maven/com.orange.qa/BUG/pom.properties > 0 2018-06-25 15:36bug/com/ > 0 2018-06-25 15:36bug/com/google/ > 0 2018-06-25 15:36bug/com/google/gson/ > 0 2018-06-25 15:36bug/com/google/gson/annotations/ > {code} > execute on Unix (CentOS or MacOS) : > {code:java} > mvn clean package -X && unzip -l target/BUG-0.1-SNAPSHOT.jar | grep com > -m15{code} > output is > {code:java} > 0 06-25-2018 18:35 bug/com/ > 0 06-25-2018 18:35 bug/com/orange/ > 0 06-25-2018 18:35 bug/com/orange/framework/ > 278 06-25-2018 18:35 bug/com/orange/framework/T.class > 0 06-25-2018 18:35 com/ > 0 06-25-2018 18:35 com/orange/ > 250 06-25-2018 18:35 com/orange/T.class > 0 06-25-2018 18:35 com/banana/ > 250 06-25-2018 18:35 com/banana/T.class > 0 06-25-2018 18:35 META-INF/maven/com.orange.qa/ > 0 06-25-2018 18:35 META-INF/maven/com.orange.qa/BUG/ > 2166 06-25-2018 18:15 META-INF/maven/com.orange.qa/BUG/pom.xml > 109 06-25-2018 18:35 META-INF/maven/com.orange.qa/BUG/pom.properties > 0 06-25-2018 18:35 bug/com/google/ > 0 06-25-2018 18:35 bug/com/google/gson/ > {code} > *Actual result:* > Relocation->exclude didn't work as expected on unix > *Expected results* is on Windows: > com/orange/framework/T must be excluded from bug.com relocations > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[GitHub] michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable
michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211384576 ## File path: wagon-providers/wagon-http/src/site/apt/index.apt ## @@ -57,3 +57,22 @@ Features * <<>> = true/false (default false), ignore issues with certificate dates. * <<>> = time in ms (default 180), read time out. + + [] + + Since version 3.2, the retry handler can be configured as well with system properties: + + * <<>> supports this set of values: + +* which implementation to use. `auto` will use `DefaultHttpRequestRetryHandler.INSTANCE`. +* `default` will use a new instance of `DefaultHttpRequestRetryHandler` respecting `requestSentEnabled`, `count` and `nonRetryableClasses`. Review comment: Please link to it. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable
michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211384615 ## File path: wagon-providers/wagon-http/src/site/apt/index.apt ## @@ -57,3 +57,22 @@ Features * <<>> = true/false (default false), ignore issues with certificate dates. * <<>> = time in ms (default 180), read time out. + + [] + + Since version 3.2, the retry handler can be configured as well with system properties: + + * <<>> supports this set of values: + +* which implementation to use. `auto` will use `DefaultHttpRequestRetryHandler.INSTANCE`. +* `default` will use a new instance of `DefaultHttpRequestRetryHandler` respecting `requestSentEnabled`, `count` and `nonRetryableClasses`. +* `standard` will use an instance of `StandardHttpRequestRetryHandler` (see https://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/org/apache/http/impl/client/StandardHttpRequestRetryHandler.html). Review comment: Make the class name a link itself. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable
michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211385200 ## File path: wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/AbstractHttpClientWagonTest.java ## @@ -51,4 +79,197 @@ public void test() wagon.disconnect(); } + +@Test +public void retryableConfigurationDefaultTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationCountTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.count", "5" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 5, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationSentTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.requestSentEnabled", "true" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertTrue( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationExceptionsTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.nonRetryableClasses", IOException.class.getName() ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); + +try +{ +final Field nonRetriableClasses = handler.getClass().getSuperclass() +.getDeclaredField( "nonRetriableClasses" ); +if (!nonRetriableClasses.isAccessible()) +{ +nonRetriableClasses.setAccessible(true); +} +final Set exceptions = Set.class.cast( nonRetriableClasses.get(handler) ); +assertEquals( 1, exceptions.size() ); +assertTrue( exceptions.contains( IOException.class ) ); +} +catch ( final Exception e ) +{ +fail( e.getMessage() ); +} +} +}); +} + +private HttpRequestRetryHandler getCurrentHandler() +{ +try +{ +final Class impl = Thread.currentThread().getContextClassLoader().loadClass( + "org.apache.maven.wagon.shared.http.AbstractHttpClientWagon" ); + +final CloseableHttpClient httpClient = CloseableHttpClient.class.cast( +impl.getMethod("getHttpClient").invoke(null) ); + +fi
[GitHub] michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable
michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211384332 ## File path: wagon-providers/wagon-http/src/site/apt/index.apt ## @@ -57,3 +57,22 @@ Features * <<>> = true/false (default false), ignore issues with certificate dates. * <<>> = time in ms (default 180), read time out. + + [] + + Since version 3.2, the retry handler can be configured as well with system properties: Review comment: ~~as well~~ This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable
michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211383035 ## File path: wagon-providers/wagon-http-shared/src/main/java/org/apache/maven/wagon/shared/http/AbstractHttpClientWagon.java ## @@ -354,6 +360,92 @@ private static PoolingHttpClientConnectionManager createConnManager() return connManager; } +/** + * The type of the retry handler, default to DefaultHttpRequestRetryHandler. + * Values can be default, standard (StandardHttpRequestRetryHandler), or a fully qualified name class. Review comment: This is inconsistent in style. Please use: `label` (`class name`), or a fully qualified class name. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable
michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211385327 ## File path: wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/AbstractHttpClientWagonTest.java ## @@ -51,4 +79,197 @@ public void test() wagon.disconnect(); } + +@Test +public void retryableConfigurationDefaultTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationCountTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.count", "5" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 5, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationSentTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.requestSentEnabled", "true" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertTrue( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationExceptionsTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.nonRetryableClasses", IOException.class.getName() ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); + +try +{ +final Field nonRetriableClasses = handler.getClass().getSuperclass() +.getDeclaredField( "nonRetriableClasses" ); +if (!nonRetriableClasses.isAccessible()) +{ +nonRetriableClasses.setAccessible(true); +} +final Set exceptions = Set.class.cast( nonRetriableClasses.get(handler) ); +assertEquals( 1, exceptions.size() ); +assertTrue( exceptions.contains( IOException.class ) ); +} +catch ( final Exception e ) +{ +fail( e.getMessage() ); +} +} +}); +} + +private HttpRequestRetryHandler getCurrentHandler() +{ +try +{ +final Class impl = Thread.currentThread().getContextClassLoader().loadClass( + "org.apache.maven.wagon.shared.http.AbstractHttpClientWagon" ); + +final CloseableHttpClient httpClient = CloseableHttpClient.class.cast( +impl.getMethod("getHttpClient").invoke(null) ); + +fi
[GitHub] michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable
michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211385369 ## File path: wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/AbstractHttpClientWagonTest.java ## @@ -51,4 +79,197 @@ public void test() wagon.disconnect(); } + +@Test +public void retryableConfigurationDefaultTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationCountTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.count", "5" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 5, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationSentTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.requestSentEnabled", "true" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertTrue( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationExceptionsTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.nonRetryableClasses", IOException.class.getName() ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); + +try +{ +final Field nonRetriableClasses = handler.getClass().getSuperclass() +.getDeclaredField( "nonRetriableClasses" ); +if (!nonRetriableClasses.isAccessible()) +{ +nonRetriableClasses.setAccessible(true); +} +final Set exceptions = Set.class.cast( nonRetriableClasses.get(handler) ); +assertEquals( 1, exceptions.size() ); +assertTrue( exceptions.contains( IOException.class ) ); +} +catch ( final Exception e ) +{ +fail( e.getMessage() ); +} +} +}); +} + +private HttpRequestRetryHandler getCurrentHandler() +{ +try +{ +final Class impl = Thread.currentThread().getContextClassLoader().loadClass( + "org.apache.maven.wagon.shared.http.AbstractHttpClientWagon" ); + +final CloseableHttpClient httpClient = CloseableHttpClient.class.cast( +impl.getMethod("getHttpClient").invoke(null) ); + +fi
[GitHub] michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable
michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211385270 ## File path: wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/AbstractHttpClientWagonTest.java ## @@ -51,4 +79,197 @@ public void test() wagon.disconnect(); } + +@Test +public void retryableConfigurationDefaultTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationCountTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.count", "5" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 5, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationSentTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.requestSentEnabled", "true" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertTrue( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationExceptionsTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.nonRetryableClasses", IOException.class.getName() ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); + +try +{ +final Field nonRetriableClasses = handler.getClass().getSuperclass() +.getDeclaredField( "nonRetriableClasses" ); +if (!nonRetriableClasses.isAccessible()) +{ +nonRetriableClasses.setAccessible(true); +} +final Set exceptions = Set.class.cast( nonRetriableClasses.get(handler) ); +assertEquals( 1, exceptions.size() ); +assertTrue( exceptions.contains( IOException.class ) ); +} +catch ( final Exception e ) +{ +fail( e.getMessage() ); +} +} +}); +} + +private HttpRequestRetryHandler getCurrentHandler() +{ +try +{ +final Class impl = Thread.currentThread().getContextClassLoader().loadClass( + "org.apache.maven.wagon.shared.http.AbstractHttpClientWagon" ); + +final CloseableHttpClient httpClient = CloseableHttpClient.class.cast( +impl.getMethod("getHttpClient").invoke(null) ); + +fi
[GitHub] michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable
michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211385912 ## File path: wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/AbstractHttpClientWagonTest.java ## @@ -51,4 +79,197 @@ public void test() wagon.disconnect(); } + +@Test +public void retryableConfigurationDefaultTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationCountTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.count", "5" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 5, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationSentTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.requestSentEnabled", "true" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertTrue( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationExceptionsTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.nonRetryableClasses", IOException.class.getName() ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); + +try +{ +final Field nonRetriableClasses = handler.getClass().getSuperclass() +.getDeclaredField( "nonRetriableClasses" ); +if (!nonRetriableClasses.isAccessible()) +{ +nonRetriableClasses.setAccessible(true); +} +final Set exceptions = Set.class.cast( nonRetriableClasses.get(handler) ); +assertEquals( 1, exceptions.size() ); +assertTrue( exceptions.contains( IOException.class ) ); +} +catch ( final Exception e ) +{ +fail( e.getMessage() ); +} +} +}); +} + +private HttpRequestRetryHandler getCurrentHandler() +{ +try +{ +final Class impl = Thread.currentThread().getContextClassLoader().loadClass( + "org.apache.maven.wagon.shared.http.AbstractHttpClientWagon" ); + +final CloseableHttpClient httpClient = CloseableHttpClient.class.cast( +impl.getMethod("getHttpClient").invoke(null) ); + +fi
[GitHub] michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable
michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211384950 ## File path: wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/AbstractHttpClientWagonTest.java ## @@ -51,4 +79,197 @@ public void test() wagon.disconnect(); } + +@Test +public void retryableConfigurationDefaultTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationCountTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.count", "5" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 5, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationSentTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.requestSentEnabled", "true" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertTrue( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationExceptionsTest() throws Exception +{ +doTestHttpClient(new Runnable() Review comment: space missing This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable
michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211385080 ## File path: wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/AbstractHttpClientWagonTest.java ## @@ -51,4 +79,197 @@ public void test() wagon.disconnect(); } + +@Test +public void retryableConfigurationDefaultTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationCountTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.count", "5" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 5, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationSentTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.requestSentEnabled", "true" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertTrue( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationExceptionsTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.nonRetryableClasses", IOException.class.getName() ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); + +try +{ +final Field nonRetriableClasses = handler.getClass().getSuperclass() +.getDeclaredField( "nonRetriableClasses" ); +if (!nonRetriableClasses.isAccessible()) +{ +nonRetriableClasses.setAccessible(true); +} +final Set exceptions = Set.class.cast( nonRetriableClasses.get(handler) ); +assertEquals( 1, exceptions.size() ); +assertTrue( exceptions.contains( IOException.class ) ); +} +catch ( final Exception e ) +{ +fail( e.getMessage() ); +} +} +}); +} + +private HttpRequestRetryHandler getCurrentHandler() +{ +try +{ +final Class impl = Thread.currentThread().getContextClassLoader().loadClass( + "org.apache.maven.wagon.shared.http.AbstractHttpClientWagon" ); + +final CloseableHttpClient httpClient = CloseableHttpClient.class.cast( +impl.getMethod("getHttpClient").invoke(null) ); Review comment
[GitHub] michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable
michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211385010 ## File path: wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/AbstractHttpClientWagonTest.java ## @@ -51,4 +79,197 @@ public void test() wagon.disconnect(); } + +@Test +public void retryableConfigurationDefaultTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationCountTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.count", "5" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 5, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationSentTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.requestSentEnabled", "true" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertTrue( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationExceptionsTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.nonRetryableClasses", IOException.class.getName() ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); + +try +{ +final Field nonRetriableClasses = handler.getClass().getSuperclass() +.getDeclaredField( "nonRetriableClasses" ); +if (!nonRetriableClasses.isAccessible()) +{ +nonRetriableClasses.setAccessible(true); Review comment: space missing This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable
michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211385807 ## File path: wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/AbstractHttpClientWagonTest.java ## @@ -51,4 +79,197 @@ public void test() wagon.disconnect(); } + +@Test +public void retryableConfigurationDefaultTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationCountTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.count", "5" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 5, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationSentTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.requestSentEnabled", "true" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertTrue( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationExceptionsTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.nonRetryableClasses", IOException.class.getName() ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); + +try +{ +final Field nonRetriableClasses = handler.getClass().getSuperclass() +.getDeclaredField( "nonRetriableClasses" ); +if (!nonRetriableClasses.isAccessible()) +{ +nonRetriableClasses.setAccessible(true); +} +final Set exceptions = Set.class.cast( nonRetriableClasses.get(handler) ); +assertEquals( 1, exceptions.size() ); +assertTrue( exceptions.contains( IOException.class ) ); +} +catch ( final Exception e ) +{ +fail( e.getMessage() ); +} +} +}); +} + +private HttpRequestRetryHandler getCurrentHandler() +{ +try +{ +final Class impl = Thread.currentThread().getContextClassLoader().loadClass( + "org.apache.maven.wagon.shared.http.AbstractHttpClientWagon" ); + +final CloseableHttpClient httpClient = CloseableHttpClient.class.cast( +impl.getMethod("getHttpClient").invoke(null) ); + +fi
[GitHub] michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable
michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211384992 ## File path: wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/AbstractHttpClientWagonTest.java ## @@ -51,4 +79,197 @@ public void test() wagon.disconnect(); } + +@Test +public void retryableConfigurationDefaultTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationCountTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.count", "5" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 5, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationSentTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.requestSentEnabled", "true" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertTrue( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationExceptionsTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.nonRetryableClasses", IOException.class.getName() ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); + +try +{ +final Field nonRetriableClasses = handler.getClass().getSuperclass() +.getDeclaredField( "nonRetriableClasses" ); +if (!nonRetriableClasses.isAccessible()) Review comment: spaces missing This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable
michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211385140 ## File path: wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/AbstractHttpClientWagonTest.java ## @@ -51,4 +79,197 @@ public void test() wagon.disconnect(); } + +@Test +public void retryableConfigurationDefaultTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationCountTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.count", "5" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 5, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationSentTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.requestSentEnabled", "true" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertTrue( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationExceptionsTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.nonRetryableClasses", IOException.class.getName() ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); + +try +{ +final Field nonRetriableClasses = handler.getClass().getSuperclass() +.getDeclaredField( "nonRetriableClasses" ); +if (!nonRetriableClasses.isAccessible()) +{ +nonRetriableClasses.setAccessible(true); +} +final Set exceptions = Set.class.cast( nonRetriableClasses.get(handler) ); +assertEquals( 1, exceptions.size() ); +assertTrue( exceptions.contains( IOException.class ) ); +} +catch ( final Exception e ) +{ +fail( e.getMessage() ); +} +} +}); +} + +private HttpRequestRetryHandler getCurrentHandler() +{ +try +{ +final Class impl = Thread.currentThread().getContextClassLoader().loadClass( + "org.apache.maven.wagon.shared.http.AbstractHttpClientWagon" ); + +final CloseableHttpClient httpClient = CloseableHttpClient.class.cast( +impl.getMethod("getHttpClient").invoke(null) ); + +fi
[GitHub] michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable
michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211385831 ## File path: wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/AbstractHttpClientWagonTest.java ## @@ -51,4 +79,197 @@ public void test() wagon.disconnect(); } + +@Test +public void retryableConfigurationDefaultTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationCountTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.count", "5" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 5, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationSentTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.requestSentEnabled", "true" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertTrue( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationExceptionsTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.nonRetryableClasses", IOException.class.getName() ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); + +try +{ +final Field nonRetriableClasses = handler.getClass().getSuperclass() +.getDeclaredField( "nonRetriableClasses" ); +if (!nonRetriableClasses.isAccessible()) +{ +nonRetriableClasses.setAccessible(true); +} +final Set exceptions = Set.class.cast( nonRetriableClasses.get(handler) ); +assertEquals( 1, exceptions.size() ); +assertTrue( exceptions.contains( IOException.class ) ); +} +catch ( final Exception e ) +{ +fail( e.getMessage() ); +} +} +}); +} + +private HttpRequestRetryHandler getCurrentHandler() +{ +try +{ +final Class impl = Thread.currentThread().getContextClassLoader().loadClass( + "org.apache.maven.wagon.shared.http.AbstractHttpClientWagon" ); + +final CloseableHttpClient httpClient = CloseableHttpClient.class.cast( +impl.getMethod("getHttpClient").invoke(null) ); + +fi
[GitHub] michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable
michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211384415 ## File path: wagon-providers/wagon-http/src/site/apt/index.apt ## @@ -57,3 +57,22 @@ Features * <<>> = true/false (default false), ignore issues with certificate dates. * <<>> = time in ms (default 180), read time out. + + [] + + Since version 3.2, the retry handler can be configured as well with system properties: + + * <<>> supports this set of values: + +* which implementation to use. `auto` will use `DefaultHttpRequestRetryHandler.INSTANCE`. Review comment: We agreed to drop auto. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable
michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211385288 ## File path: wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/AbstractHttpClientWagonTest.java ## @@ -51,4 +79,197 @@ public void test() wagon.disconnect(); } + +@Test +public void retryableConfigurationDefaultTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationCountTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.count", "5" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 5, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationSentTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.requestSentEnabled", "true" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertTrue( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationExceptionsTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.nonRetryableClasses", IOException.class.getName() ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); + +try +{ +final Field nonRetriableClasses = handler.getClass().getSuperclass() +.getDeclaredField( "nonRetriableClasses" ); +if (!nonRetriableClasses.isAccessible()) +{ +nonRetriableClasses.setAccessible(true); +} +final Set exceptions = Set.class.cast( nonRetriableClasses.get(handler) ); +assertEquals( 1, exceptions.size() ); +assertTrue( exceptions.contains( IOException.class ) ); +} +catch ( final Exception e ) +{ +fail( e.getMessage() ); +} +} +}); +} + +private HttpRequestRetryHandler getCurrentHandler() +{ +try +{ +final Class impl = Thread.currentThread().getContextClassLoader().loadClass( + "org.apache.maven.wagon.shared.http.AbstractHttpClientWagon" ); + +final CloseableHttpClient httpClient = CloseableHttpClient.class.cast( +impl.getMethod("getHttpClient").invoke(null) ); + +fi
[GitHub] michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable
michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211383488 ## File path: wagon-providers/wagon-http-shared/src/main/java/org/apache/maven/wagon/shared/http/AbstractHttpClientWagon.java ## @@ -354,6 +360,92 @@ private static PoolingHttpClientConnectionManager createConnManager() return connManager; } +/** + * The type of the retry handler, default to DefaultHttpRequestRetryHandler. + * Values can be default, standard (StandardHttpRequestRetryHandler), or a fully qualified name class. + * + * @since 3.2 + */ +private static final String RETRY_HANDLER_CLASS = +System.getProperty( "maven.wagon.http.retryhandler.class", "standard" ); + +/** + * true if it's OK to retry non-idempotent requests that have been sent. Review comment: This statement is not true. The original documentation does not say this. Even the default implementation will stop before this value is read if the request ist not idempotent. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable
michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211383797 ## File path: wagon-providers/wagon-http-shared/src/main/java/org/apache/maven/wagon/shared/http/AbstractHttpClientWagon.java ## @@ -354,6 +360,92 @@ private static PoolingHttpClientConnectionManager createConnManager() return connManager; } +/** + * The type of the retry handler, default to DefaultHttpRequestRetryHandler. + * Values can be default, standard (StandardHttpRequestRetryHandler), or a fully qualified name class. + * + * @since 3.2 + */ +private static final String RETRY_HANDLER_CLASS = +System.getProperty( "maven.wagon.http.retryhandler.class", "standard" ); + +/** + * true if it's OK to retry non-idempotent requests that have been sent. + * Note: only used for default and standard retry handlers. + * + * @since 3.2 + */ +private static final boolean RETRY_HANDLER_REQUEST_SENT_ENABLED = +Boolean.getBoolean( "maven.wagon.http.retryhandler.requestSentEnabled" ); + +/** + * Number of retries for the retry handler. + * Note: only used for default and standard retry handlers. + * + * @since 3.2 + */ +private static final int RETRY_HANDLER_COUNT = +Integer.getInteger( "maven.wagon.http.retryhandler.count", 3 ); + +/** + * Comma separated list of non retryable classes. + * Note: only used for default retry handler. + * + * @since 3.0.1 + */ +private static final String RETRY_HANDLER_EXCEPTIONS = +System.getProperty( "maven.wagon.http.retryhandler.nonRetryableClasses" ); + +private static HttpRequestRetryHandler createRetryHandler() +{ +switch ( RETRY_HANDLER_CLASS ) +{ +case "default": +if ( RETRY_HANDLER_EXCEPTIONS == null ) Review comment: I'd rather rely on `StringUtils#isEmpty()`. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable
michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211385033 ## File path: wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/AbstractHttpClientWagonTest.java ## @@ -51,4 +79,197 @@ public void test() wagon.disconnect(); } + +@Test +public void retryableConfigurationDefaultTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationCountTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.count", "5" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 5, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationSentTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.requestSentEnabled", "true" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertTrue( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationExceptionsTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.nonRetryableClasses", IOException.class.getName() ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); + +try +{ +final Field nonRetriableClasses = handler.getClass().getSuperclass() +.getDeclaredField( "nonRetriableClasses" ); +if (!nonRetriableClasses.isAccessible()) +{ +nonRetriableClasses.setAccessible(true); +} +final Set exceptions = Set.class.cast( nonRetriableClasses.get(handler) ); Review comment: space missing This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable
michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211385757 ## File path: wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/AbstractHttpClientWagonTest.java ## @@ -51,4 +79,197 @@ public void test() wagon.disconnect(); } + +@Test +public void retryableConfigurationDefaultTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationCountTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.count", "5" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 5, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationSentTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.requestSentEnabled", "true" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertTrue( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationExceptionsTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.nonRetryableClasses", IOException.class.getName() ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); + +try +{ +final Field nonRetriableClasses = handler.getClass().getSuperclass() +.getDeclaredField( "nonRetriableClasses" ); +if (!nonRetriableClasses.isAccessible()) +{ +nonRetriableClasses.setAccessible(true); +} +final Set exceptions = Set.class.cast( nonRetriableClasses.get(handler) ); +assertEquals( 1, exceptions.size() ); +assertTrue( exceptions.contains( IOException.class ) ); +} +catch ( final Exception e ) +{ +fail( e.getMessage() ); +} +} +}); +} + +private HttpRequestRetryHandler getCurrentHandler() +{ +try +{ +final Class impl = Thread.currentThread().getContextClassLoader().loadClass( + "org.apache.maven.wagon.shared.http.AbstractHttpClientWagon" ); + +final CloseableHttpClient httpClient = CloseableHttpClient.class.cast( +impl.getMethod("getHttpClient").invoke(null) ); + +fi
[GitHub] michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable
michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211385251 ## File path: wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/AbstractHttpClientWagonTest.java ## @@ -51,4 +79,197 @@ public void test() wagon.disconnect(); } + +@Test +public void retryableConfigurationDefaultTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationCountTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.count", "5" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 5, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationSentTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.requestSentEnabled", "true" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertTrue( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationExceptionsTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.nonRetryableClasses", IOException.class.getName() ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); + +try +{ +final Field nonRetriableClasses = handler.getClass().getSuperclass() +.getDeclaredField( "nonRetriableClasses" ); +if (!nonRetriableClasses.isAccessible()) +{ +nonRetriableClasses.setAccessible(true); +} +final Set exceptions = Set.class.cast( nonRetriableClasses.get(handler) ); +assertEquals( 1, exceptions.size() ); +assertTrue( exceptions.contains( IOException.class ) ); +} +catch ( final Exception e ) +{ +fail( e.getMessage() ); +} +} +}); +} + +private HttpRequestRetryHandler getCurrentHandler() +{ +try +{ +final Class impl = Thread.currentThread().getContextClassLoader().loadClass( + "org.apache.maven.wagon.shared.http.AbstractHttpClientWagon" ); + +final CloseableHttpClient httpClient = CloseableHttpClient.class.cast( +impl.getMethod("getHttpClient").invoke(null) ); + +fi
[GitHub] michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable
michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211380849 ## File path: wagon-providers/wagon-http-shared/src/main/java/org/apache/maven/wagon/shared/http/AbstractHttpClientWagon.java ## @@ -354,6 +360,92 @@ private static PoolingHttpClientConnectionManager createConnManager() return connManager; } +/** + * The type of the retry handler, default to DefaultHttpRequestRetryHandler. + * Values can be default, standard (StandardHttpRequestRetryHandler), or a fully qualified name class. + * + * @since 3.2 + */ +private static final String RETRY_HANDLER_CLASS = +System.getProperty( "maven.wagon.http.retryhandler.class", "standard" ); + +/** + * true if it's OK to retry non-idempotent requests that have been sent. + * Note: only used for default and standard retry handlers. + * + * @since 3.2 + */ +private static final boolean RETRY_HANDLER_REQUEST_SENT_ENABLED = +Boolean.getBoolean( "maven.wagon.http.retryhandler.requestSentEnabled" ); + +/** + * Number of retries for the retry handler. + * Note: only used for default and standard retry handlers. + * + * @since 3.2 + */ +private static final int RETRY_HANDLER_COUNT = +Integer.getInteger( "maven.wagon.http.retryhandler.count", 3 ); + +/** + * Comma separated list of non retryable classes. + * Note: only used for default retry handler. + * + * @since 3.0.1 Review comment: Still wrong. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable
michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211380988 ## File path: wagon-providers/wagon-http-shared/src/main/java/org/apache/maven/wagon/shared/http/AbstractHttpClientWagon.java ## @@ -354,6 +366,97 @@ private static PoolingHttpClientConnectionManager createConnManager() return connManager; } +/** + * The type of the retry handler, default to DefaultHttpRequestRetryHandler. + * Values can be default, standard (StandardHttpRequestRetryHandler), or a fully qualified name class. + * + * @since 3.0.1 + */ +private static final String RETRY_HANDLER_CLASS = +System.getProperty( "maven.wagon.http.retryhandler.class", "auto" ); + +/** + * true if it's OK to retry non-idempotent requests that have been sent. + * Note: only used for default and standard retry handlers. + * + * @since 3.0.1 + */ +private static final boolean RETRY_HANDLER_REQUEST_SENT_ENABLED = +Boolean.getBoolean( "maven.wagon.http.retryhandler.requestSentEnabled" ); + +/** + * Number of retries for the retry handler. + * Note: only used for default and standard retry handlers. + * + * @since 3.0.1 + */ +private static final int RETRY_HANDLER_COUNT = +Integer.getInteger( "maven.wagon.http.retryhandler.count", 3 ); + +private static final String DEFAULT_NON_RETRYABLE_CLASSES = +InterruptedIOException.class.getName() + "," ++ UnknownHostException.class.getName() + "," ++ ConnectException.class.getName() + "," ++ SSLException.class.getName(); +/** + * Comma separated list of non retryable classes. + * Note: only used for default retry handler. + * + * @since 3.0.1 + */ +private static final String RETRY_HANDLER_EXCEPTIONS = +System.getProperty( "maven.wagon.http.retryhandler.nonRetryableClasses", DEFAULT_NON_RETRYABLE_CLASSES ); + +private static HttpRequestRetryHandler createRetryHandler() +{ +switch ( RETRY_HANDLER_CLASS ) +{ +case "default": +if ( DEFAULT_NON_RETRYABLE_CLASSES.equals( RETRY_HANDLER_EXCEPTIONS ) ) +{ +return new DefaultHttpRequestRetryHandler( +RETRY_HANDLER_COUNT, RETRY_HANDLER_REQUEST_SENT_ENABLED ); +} +return new DefaultHttpRequestRetryHandler( +RETRY_HANDLER_COUNT, RETRY_HANDLER_REQUEST_SENT_ENABLED, getNonRetryableExceptions() ) +{ +}; +case "standard": +return new StandardHttpRequestRetryHandler( RETRY_HANDLER_COUNT, RETRY_HANDLER_REQUEST_SENT_ENABLED ); +case "auto": Review comment: This needs to be dropped completely. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable
michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211385112 ## File path: wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/AbstractHttpClientWagonTest.java ## @@ -51,4 +79,197 @@ public void test() wagon.disconnect(); } + +@Test +public void retryableConfigurationDefaultTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationCountTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.count", "5" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 5, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationSentTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.requestSentEnabled", "true" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertTrue( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationExceptionsTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.nonRetryableClasses", IOException.class.getName() ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); + +try +{ +final Field nonRetriableClasses = handler.getClass().getSuperclass() +.getDeclaredField( "nonRetriableClasses" ); +if (!nonRetriableClasses.isAccessible()) +{ +nonRetriableClasses.setAccessible(true); +} +final Set exceptions = Set.class.cast( nonRetriableClasses.get(handler) ); +assertEquals( 1, exceptions.size() ); +assertTrue( exceptions.contains( IOException.class ) ); +} +catch ( final Exception e ) +{ +fail( e.getMessage() ); +} +} +}); +} + +private HttpRequestRetryHandler getCurrentHandler() +{ +try +{ +final Class impl = Thread.currentThread().getContextClassLoader().loadClass( + "org.apache.maven.wagon.shared.http.AbstractHttpClientWagon" ); + +final CloseableHttpClient httpClient = CloseableHttpClient.class.cast( +impl.getMethod("getHttpClient").invoke(null) ); + +fi
[GitHub] michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable
michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211385725 ## File path: wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/AbstractHttpClientWagonTest.java ## @@ -51,4 +79,197 @@ public void test() wagon.disconnect(); } + +@Test +public void retryableConfigurationDefaultTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationCountTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.count", "5" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 5, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationSentTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.requestSentEnabled", "true" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertTrue( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationExceptionsTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.nonRetryableClasses", IOException.class.getName() ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); + +try +{ +final Field nonRetriableClasses = handler.getClass().getSuperclass() +.getDeclaredField( "nonRetriableClasses" ); +if (!nonRetriableClasses.isAccessible()) +{ +nonRetriableClasses.setAccessible(true); +} +final Set exceptions = Set.class.cast( nonRetriableClasses.get(handler) ); +assertEquals( 1, exceptions.size() ); +assertTrue( exceptions.contains( IOException.class ) ); +} +catch ( final Exception e ) +{ +fail( e.getMessage() ); +} +} +}); +} + +private HttpRequestRetryHandler getCurrentHandler() +{ +try +{ +final Class impl = Thread.currentThread().getContextClassLoader().loadClass( + "org.apache.maven.wagon.shared.http.AbstractHttpClientWagon" ); + +final CloseableHttpClient httpClient = CloseableHttpClient.class.cast( +impl.getMethod("getHttpClient").invoke(null) ); + +fi
[GitHub] michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable
michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211385162 ## File path: wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/AbstractHttpClientWagonTest.java ## @@ -51,4 +79,197 @@ public void test() wagon.disconnect(); } + +@Test +public void retryableConfigurationDefaultTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationCountTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.count", "5" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 5, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationSentTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.requestSentEnabled", "true" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertTrue( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationExceptionsTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.nonRetryableClasses", IOException.class.getName() ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); + +try +{ +final Field nonRetriableClasses = handler.getClass().getSuperclass() +.getDeclaredField( "nonRetriableClasses" ); +if (!nonRetriableClasses.isAccessible()) +{ +nonRetriableClasses.setAccessible(true); +} +final Set exceptions = Set.class.cast( nonRetriableClasses.get(handler) ); +assertEquals( 1, exceptions.size() ); +assertTrue( exceptions.contains( IOException.class ) ); +} +catch ( final Exception e ) +{ +fail( e.getMessage() ); +} +} +}); +} + +private HttpRequestRetryHandler getCurrentHandler() +{ +try +{ +final Class impl = Thread.currentThread().getContextClassLoader().loadClass( + "org.apache.maven.wagon.shared.http.AbstractHttpClientWagon" ); + +final CloseableHttpClient httpClient = CloseableHttpClient.class.cast( +impl.getMethod("getHttpClient").invoke(null) ); + +fi
[GitHub] michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable
michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211385850 ## File path: wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/AbstractHttpClientWagonTest.java ## @@ -51,4 +79,197 @@ public void test() wagon.disconnect(); } + +@Test +public void retryableConfigurationDefaultTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationCountTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.count", "5" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 5, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationSentTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.requestSentEnabled", "true" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertTrue( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationExceptionsTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.nonRetryableClasses", IOException.class.getName() ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); + +try +{ +final Field nonRetriableClasses = handler.getClass().getSuperclass() +.getDeclaredField( "nonRetriableClasses" ); +if (!nonRetriableClasses.isAccessible()) +{ +nonRetriableClasses.setAccessible(true); +} +final Set exceptions = Set.class.cast( nonRetriableClasses.get(handler) ); +assertEquals( 1, exceptions.size() ); +assertTrue( exceptions.contains( IOException.class ) ); +} +catch ( final Exception e ) +{ +fail( e.getMessage() ); +} +} +}); +} + +private HttpRequestRetryHandler getCurrentHandler() +{ +try +{ +final Class impl = Thread.currentThread().getContextClassLoader().loadClass( + "org.apache.maven.wagon.shared.http.AbstractHttpClientWagon" ); + +final CloseableHttpClient httpClient = CloseableHttpClient.class.cast( +impl.getMethod("getHttpClient").invoke(null) ); + +fi
[jira] [Commented] (WAGON-526) making the retry handle of http client configurable
[ https://issues.apache.org/jira/browse/WAGON-526?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16586416#comment-16586416 ] ASF GitHub Bot commented on WAGON-526: -- michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211380988 ## File path: wagon-providers/wagon-http-shared/src/main/java/org/apache/maven/wagon/shared/http/AbstractHttpClientWagon.java ## @@ -354,6 +366,97 @@ private static PoolingHttpClientConnectionManager createConnManager() return connManager; } +/** + * The type of the retry handler, default to DefaultHttpRequestRetryHandler. + * Values can be default, standard (StandardHttpRequestRetryHandler), or a fully qualified name class. + * + * @since 3.0.1 + */ +private static final String RETRY_HANDLER_CLASS = +System.getProperty( "maven.wagon.http.retryhandler.class", "auto" ); + +/** + * true if it's OK to retry non-idempotent requests that have been sent. + * Note: only used for default and standard retry handlers. + * + * @since 3.0.1 + */ +private static final boolean RETRY_HANDLER_REQUEST_SENT_ENABLED = +Boolean.getBoolean( "maven.wagon.http.retryhandler.requestSentEnabled" ); + +/** + * Number of retries for the retry handler. + * Note: only used for default and standard retry handlers. + * + * @since 3.0.1 + */ +private static final int RETRY_HANDLER_COUNT = +Integer.getInteger( "maven.wagon.http.retryhandler.count", 3 ); + +private static final String DEFAULT_NON_RETRYABLE_CLASSES = +InterruptedIOException.class.getName() + "," ++ UnknownHostException.class.getName() + "," ++ ConnectException.class.getName() + "," ++ SSLException.class.getName(); +/** + * Comma separated list of non retryable classes. + * Note: only used for default retry handler. + * + * @since 3.0.1 + */ +private static final String RETRY_HANDLER_EXCEPTIONS = +System.getProperty( "maven.wagon.http.retryhandler.nonRetryableClasses", DEFAULT_NON_RETRYABLE_CLASSES ); + +private static HttpRequestRetryHandler createRetryHandler() +{ +switch ( RETRY_HANDLER_CLASS ) +{ +case "default": +if ( DEFAULT_NON_RETRYABLE_CLASSES.equals( RETRY_HANDLER_EXCEPTIONS ) ) +{ +return new DefaultHttpRequestRetryHandler( +RETRY_HANDLER_COUNT, RETRY_HANDLER_REQUEST_SENT_ENABLED ); +} +return new DefaultHttpRequestRetryHandler( +RETRY_HANDLER_COUNT, RETRY_HANDLER_REQUEST_SENT_ENABLED, getNonRetryableExceptions() ) +{ +}; +case "standard": +return new StandardHttpRequestRetryHandler( RETRY_HANDLER_COUNT, RETRY_HANDLER_REQUEST_SENT_ENABLED ); +case "auto": Review comment: This needs to be dropped completely. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > making the retry handle of http client configurable > --- > > Key: WAGON-526 > URL: https://issues.apache.org/jira/browse/WAGON-526 > Project: Maven Wagon > Issue Type: New Feature >Reporter: Romain Manni-Bucau >Priority: Major > > Provide a way to customize a lot (until a custom impl) the way wagon retries > downloads. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (WAGON-526) making the retry handle of http client configurable
[ https://issues.apache.org/jira/browse/WAGON-526?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16586426#comment-16586426 ] ASF GitHub Bot commented on WAGON-526: -- michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211384332 ## File path: wagon-providers/wagon-http/src/site/apt/index.apt ## @@ -57,3 +57,22 @@ Features * <<>> = true/false (default false), ignore issues with certificate dates. * <<>> = time in ms (default 180), read time out. + + [] + + Since version 3.2, the retry handler can be configured as well with system properties: Review comment: ~~as well~~ This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > making the retry handle of http client configurable > --- > > Key: WAGON-526 > URL: https://issues.apache.org/jira/browse/WAGON-526 > Project: Maven Wagon > Issue Type: New Feature >Reporter: Romain Manni-Bucau >Priority: Major > > Provide a way to customize a lot (until a custom impl) the way wagon retries > downloads. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (WAGON-526) making the retry handle of http client configurable
[ https://issues.apache.org/jira/browse/WAGON-526?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16586429#comment-16586429 ] ASF GitHub Bot commented on WAGON-526: -- michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211385033 ## File path: wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/AbstractHttpClientWagonTest.java ## @@ -51,4 +79,197 @@ public void test() wagon.disconnect(); } + +@Test +public void retryableConfigurationDefaultTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationCountTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.count", "5" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 5, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationSentTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.requestSentEnabled", "true" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertTrue( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationExceptionsTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.nonRetryableClasses", IOException.class.getName() ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); + +try +{ +final Field nonRetriableClasses = handler.getClass().getSuperclass() +.getDeclaredField( "nonRetriableClasses" ); +if (!nonRetriableClasses.isAccessible()) +{ +nonRetriableClasses.setAccessible(true); +} +final Set exceptions = Set.class.cast( nonRetriableClasses.get(handler) ); Review comment: space missing This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > making the retry handle of http client configurable > --- > > Key: WAGON-526 >
[jira] [Commented] (WAGON-526) making the retry handle of http client configurable
[ https://issues.apache.org/jira/browse/WAGON-526?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16586433#comment-16586433 ] ASF GitHub Bot commented on WAGON-526: -- michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211385288 ## File path: wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/AbstractHttpClientWagonTest.java ## @@ -51,4 +79,197 @@ public void test() wagon.disconnect(); } + +@Test +public void retryableConfigurationDefaultTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationCountTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.count", "5" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 5, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationSentTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.requestSentEnabled", "true" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertTrue( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationExceptionsTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.nonRetryableClasses", IOException.class.getName() ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); + +try +{ +final Field nonRetriableClasses = handler.getClass().getSuperclass() +.getDeclaredField( "nonRetriableClasses" ); +if (!nonRetriableClasses.isAccessible()) +{ +nonRetriableClasses.setAccessible(true); +} +final Set exceptions = Set.class.cast( nonRetriableClasses.get(handler) ); +assertEquals( 1, exceptions.size() ); +assertTrue( exceptions.contains( IOException.class ) ); +} +catch ( final Exception e ) +{ +fail( e.getMessage() ); +} +} +}); +} + +private HttpRequestRetryHandler getCurrentHandler() +{ +try +{ +final Class impl = Thread.currentThread().getContextClassLoader().loadClass( +
[jira] [Commented] (WAGON-526) making the retry handle of http client configurable
[ https://issues.apache.org/jira/browse/WAGON-526?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16586412#comment-16586412 ] ASF GitHub Bot commented on WAGON-526: -- michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211380849 ## File path: wagon-providers/wagon-http-shared/src/main/java/org/apache/maven/wagon/shared/http/AbstractHttpClientWagon.java ## @@ -354,6 +360,92 @@ private static PoolingHttpClientConnectionManager createConnManager() return connManager; } +/** + * The type of the retry handler, default to DefaultHttpRequestRetryHandler. + * Values can be default, standard (StandardHttpRequestRetryHandler), or a fully qualified name class. + * + * @since 3.2 + */ +private static final String RETRY_HANDLER_CLASS = +System.getProperty( "maven.wagon.http.retryhandler.class", "standard" ); + +/** + * true if it's OK to retry non-idempotent requests that have been sent. + * Note: only used for default and standard retry handlers. + * + * @since 3.2 + */ +private static final boolean RETRY_HANDLER_REQUEST_SENT_ENABLED = +Boolean.getBoolean( "maven.wagon.http.retryhandler.requestSentEnabled" ); + +/** + * Number of retries for the retry handler. + * Note: only used for default and standard retry handlers. + * + * @since 3.2 + */ +private static final int RETRY_HANDLER_COUNT = +Integer.getInteger( "maven.wagon.http.retryhandler.count", 3 ); + +/** + * Comma separated list of non retryable classes. + * Note: only used for default retry handler. + * + * @since 3.0.1 Review comment: Still wrong. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > making the retry handle of http client configurable > --- > > Key: WAGON-526 > URL: https://issues.apache.org/jira/browse/WAGON-526 > Project: Maven Wagon > Issue Type: New Feature >Reporter: Romain Manni-Bucau >Priority: Major > > Provide a way to customize a lot (until a custom impl) the way wagon retries > downloads. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (WAGON-526) making the retry handle of http client configurable
[ https://issues.apache.org/jira/browse/WAGON-526?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16586417#comment-16586417 ] ASF GitHub Bot commented on WAGON-526: -- michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211384415 ## File path: wagon-providers/wagon-http/src/site/apt/index.apt ## @@ -57,3 +57,22 @@ Features * <<>> = true/false (default false), ignore issues with certificate dates. * <<>> = time in ms (default 180), read time out. + + [] + + Since version 3.2, the retry handler can be configured as well with system properties: + + * <<>> supports this set of values: + +* which implementation to use. `auto` will use `DefaultHttpRequestRetryHandler.INSTANCE`. Review comment: We agreed to drop auto. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > making the retry handle of http client configurable > --- > > Key: WAGON-526 > URL: https://issues.apache.org/jira/browse/WAGON-526 > Project: Maven Wagon > Issue Type: New Feature >Reporter: Romain Manni-Bucau >Priority: Major > > Provide a way to customize a lot (until a custom impl) the way wagon retries > downloads. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (WAGON-526) making the retry handle of http client configurable
[ https://issues.apache.org/jira/browse/WAGON-526?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16586413#comment-16586413 ] ASF GitHub Bot commented on WAGON-526: -- michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211383035 ## File path: wagon-providers/wagon-http-shared/src/main/java/org/apache/maven/wagon/shared/http/AbstractHttpClientWagon.java ## @@ -354,6 +360,92 @@ private static PoolingHttpClientConnectionManager createConnManager() return connManager; } +/** + * The type of the retry handler, default to DefaultHttpRequestRetryHandler. + * Values can be default, standard (StandardHttpRequestRetryHandler), or a fully qualified name class. Review comment: This is inconsistent in style. Please use: `label` (`class name`), or a fully qualified class name. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > making the retry handle of http client configurable > --- > > Key: WAGON-526 > URL: https://issues.apache.org/jira/browse/WAGON-526 > Project: Maven Wagon > Issue Type: New Feature >Reporter: Romain Manni-Bucau >Priority: Major > > Provide a way to customize a lot (until a custom impl) the way wagon retries > downloads. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (WAGON-526) making the retry handle of http client configurable
[ https://issues.apache.org/jira/browse/WAGON-526?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16586419#comment-16586419 ] ASF GitHub Bot commented on WAGON-526: -- michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211384576 ## File path: wagon-providers/wagon-http/src/site/apt/index.apt ## @@ -57,3 +57,22 @@ Features * <<>> = true/false (default false), ignore issues with certificate dates. * <<>> = time in ms (default 180), read time out. + + [] + + Since version 3.2, the retry handler can be configured as well with system properties: + + * <<>> supports this set of values: + +* which implementation to use. `auto` will use `DefaultHttpRequestRetryHandler.INSTANCE`. +* `default` will use a new instance of `DefaultHttpRequestRetryHandler` respecting `requestSentEnabled`, `count` and `nonRetryableClasses`. Review comment: Please link to it. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > making the retry handle of http client configurable > --- > > Key: WAGON-526 > URL: https://issues.apache.org/jira/browse/WAGON-526 > Project: Maven Wagon > Issue Type: New Feature >Reporter: Romain Manni-Bucau >Priority: Major > > Provide a way to customize a lot (until a custom impl) the way wagon retries > downloads. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (WAGON-526) making the retry handle of http client configurable
[ https://issues.apache.org/jira/browse/WAGON-526?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16586414#comment-16586414 ] ASF GitHub Bot commented on WAGON-526: -- michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211383488 ## File path: wagon-providers/wagon-http-shared/src/main/java/org/apache/maven/wagon/shared/http/AbstractHttpClientWagon.java ## @@ -354,6 +360,92 @@ private static PoolingHttpClientConnectionManager createConnManager() return connManager; } +/** + * The type of the retry handler, default to DefaultHttpRequestRetryHandler. + * Values can be default, standard (StandardHttpRequestRetryHandler), or a fully qualified name class. + * + * @since 3.2 + */ +private static final String RETRY_HANDLER_CLASS = +System.getProperty( "maven.wagon.http.retryhandler.class", "standard" ); + +/** + * true if it's OK to retry non-idempotent requests that have been sent. Review comment: This statement is not true. The original documentation does not say this. Even the default implementation will stop before this value is read if the request ist not idempotent. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > making the retry handle of http client configurable > --- > > Key: WAGON-526 > URL: https://issues.apache.org/jira/browse/WAGON-526 > Project: Maven Wagon > Issue Type: New Feature >Reporter: Romain Manni-Bucau >Priority: Major > > Provide a way to customize a lot (until a custom impl) the way wagon retries > downloads. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (WAGON-526) making the retry handle of http client configurable
[ https://issues.apache.org/jira/browse/WAGON-526?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16586428#comment-16586428 ] ASF GitHub Bot commented on WAGON-526: -- michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211385850 ## File path: wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/AbstractHttpClientWagonTest.java ## @@ -51,4 +79,197 @@ public void test() wagon.disconnect(); } + +@Test +public void retryableConfigurationDefaultTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationCountTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.count", "5" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 5, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationSentTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.requestSentEnabled", "true" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertTrue( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationExceptionsTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.nonRetryableClasses", IOException.class.getName() ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); + +try +{ +final Field nonRetriableClasses = handler.getClass().getSuperclass() +.getDeclaredField( "nonRetriableClasses" ); +if (!nonRetriableClasses.isAccessible()) +{ +nonRetriableClasses.setAccessible(true); +} +final Set exceptions = Set.class.cast( nonRetriableClasses.get(handler) ); +assertEquals( 1, exceptions.size() ); +assertTrue( exceptions.contains( IOException.class ) ); +} +catch ( final Exception e ) +{ +fail( e.getMessage() ); +} +} +}); +} + +private HttpRequestRetryHandler getCurrentHandler() +{ +try +{ +final Class impl = Thread.currentThread().getContextClassLoader().loadClass( +
[jira] [Commented] (WAGON-526) making the retry handle of http client configurable
[ https://issues.apache.org/jira/browse/WAGON-526?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16586415#comment-16586415 ] ASF GitHub Bot commented on WAGON-526: -- michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211383797 ## File path: wagon-providers/wagon-http-shared/src/main/java/org/apache/maven/wagon/shared/http/AbstractHttpClientWagon.java ## @@ -354,6 +360,92 @@ private static PoolingHttpClientConnectionManager createConnManager() return connManager; } +/** + * The type of the retry handler, default to DefaultHttpRequestRetryHandler. + * Values can be default, standard (StandardHttpRequestRetryHandler), or a fully qualified name class. + * + * @since 3.2 + */ +private static final String RETRY_HANDLER_CLASS = +System.getProperty( "maven.wagon.http.retryhandler.class", "standard" ); + +/** + * true if it's OK to retry non-idempotent requests that have been sent. + * Note: only used for default and standard retry handlers. + * + * @since 3.2 + */ +private static final boolean RETRY_HANDLER_REQUEST_SENT_ENABLED = +Boolean.getBoolean( "maven.wagon.http.retryhandler.requestSentEnabled" ); + +/** + * Number of retries for the retry handler. + * Note: only used for default and standard retry handlers. + * + * @since 3.2 + */ +private static final int RETRY_HANDLER_COUNT = +Integer.getInteger( "maven.wagon.http.retryhandler.count", 3 ); + +/** + * Comma separated list of non retryable classes. + * Note: only used for default retry handler. + * + * @since 3.0.1 + */ +private static final String RETRY_HANDLER_EXCEPTIONS = +System.getProperty( "maven.wagon.http.retryhandler.nonRetryableClasses" ); + +private static HttpRequestRetryHandler createRetryHandler() +{ +switch ( RETRY_HANDLER_CLASS ) +{ +case "default": +if ( RETRY_HANDLER_EXCEPTIONS == null ) Review comment: I'd rather rely on `StringUtils#isEmpty()`. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > making the retry handle of http client configurable > --- > > Key: WAGON-526 > URL: https://issues.apache.org/jira/browse/WAGON-526 > Project: Maven Wagon > Issue Type: New Feature >Reporter: Romain Manni-Bucau >Priority: Major > > Provide a way to customize a lot (until a custom impl) the way wagon retries > downloads. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (WAGON-526) making the retry handle of http client configurable
[ https://issues.apache.org/jira/browse/WAGON-526?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16586437#comment-16586437 ] ASF GitHub Bot commented on WAGON-526: -- michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211385807 ## File path: wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/AbstractHttpClientWagonTest.java ## @@ -51,4 +79,197 @@ public void test() wagon.disconnect(); } + +@Test +public void retryableConfigurationDefaultTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationCountTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.count", "5" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 5, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationSentTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.requestSentEnabled", "true" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertTrue( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationExceptionsTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.nonRetryableClasses", IOException.class.getName() ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); + +try +{ +final Field nonRetriableClasses = handler.getClass().getSuperclass() +.getDeclaredField( "nonRetriableClasses" ); +if (!nonRetriableClasses.isAccessible()) +{ +nonRetriableClasses.setAccessible(true); +} +final Set exceptions = Set.class.cast( nonRetriableClasses.get(handler) ); +assertEquals( 1, exceptions.size() ); +assertTrue( exceptions.contains( IOException.class ) ); +} +catch ( final Exception e ) +{ +fail( e.getMessage() ); +} +} +}); +} + +private HttpRequestRetryHandler getCurrentHandler() +{ +try +{ +final Class impl = Thread.currentThread().getContextClassLoader().loadClass( +
[jira] [Commented] (WAGON-526) making the retry handle of http client configurable
[ https://issues.apache.org/jira/browse/WAGON-526?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16586420#comment-16586420 ] ASF GitHub Bot commented on WAGON-526: -- michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211384615 ## File path: wagon-providers/wagon-http/src/site/apt/index.apt ## @@ -57,3 +57,22 @@ Features * <<>> = true/false (default false), ignore issues with certificate dates. * <<>> = time in ms (default 180), read time out. + + [] + + Since version 3.2, the retry handler can be configured as well with system properties: + + * <<>> supports this set of values: + +* which implementation to use. `auto` will use `DefaultHttpRequestRetryHandler.INSTANCE`. +* `default` will use a new instance of `DefaultHttpRequestRetryHandler` respecting `requestSentEnabled`, `count` and `nonRetryableClasses`. +* `standard` will use an instance of `StandardHttpRequestRetryHandler` (see https://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/org/apache/http/impl/client/StandardHttpRequestRetryHandler.html). Review comment: Make the class name a link itself. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > making the retry handle of http client configurable > --- > > Key: WAGON-526 > URL: https://issues.apache.org/jira/browse/WAGON-526 > Project: Maven Wagon > Issue Type: New Feature >Reporter: Romain Manni-Bucau >Priority: Major > > Provide a way to customize a lot (until a custom impl) the way wagon retries > downloads. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (WAGON-526) making the retry handle of http client configurable
[ https://issues.apache.org/jira/browse/WAGON-526?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16586418#comment-16586418 ] ASF GitHub Bot commented on WAGON-526: -- michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211384950 ## File path: wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/AbstractHttpClientWagonTest.java ## @@ -51,4 +79,197 @@ public void test() wagon.disconnect(); } + +@Test +public void retryableConfigurationDefaultTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationCountTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.count", "5" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 5, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationSentTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.requestSentEnabled", "true" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertTrue( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationExceptionsTest() throws Exception +{ +doTestHttpClient(new Runnable() Review comment: space missing This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > making the retry handle of http client configurable > --- > > Key: WAGON-526 > URL: https://issues.apache.org/jira/browse/WAGON-526 > Project: Maven Wagon > Issue Type: New Feature >Reporter: Romain Manni-Bucau >Priority: Major > > Provide a way to customize a lot (until a custom impl) the way wagon retries > downloads. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (WAGON-526) making the retry handle of http client configurable
[ https://issues.apache.org/jira/browse/WAGON-526?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16586436#comment-16586436 ] ASF GitHub Bot commented on WAGON-526: -- michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211385251 ## File path: wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/AbstractHttpClientWagonTest.java ## @@ -51,4 +79,197 @@ public void test() wagon.disconnect(); } + +@Test +public void retryableConfigurationDefaultTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationCountTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.count", "5" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 5, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationSentTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.requestSentEnabled", "true" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertTrue( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationExceptionsTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.nonRetryableClasses", IOException.class.getName() ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); + +try +{ +final Field nonRetriableClasses = handler.getClass().getSuperclass() +.getDeclaredField( "nonRetriableClasses" ); +if (!nonRetriableClasses.isAccessible()) +{ +nonRetriableClasses.setAccessible(true); +} +final Set exceptions = Set.class.cast( nonRetriableClasses.get(handler) ); +assertEquals( 1, exceptions.size() ); +assertTrue( exceptions.contains( IOException.class ) ); +} +catch ( final Exception e ) +{ +fail( e.getMessage() ); +} +} +}); +} + +private HttpRequestRetryHandler getCurrentHandler() +{ +try +{ +final Class impl = Thread.currentThread().getContextClassLoader().loadClass( +
[jira] [Commented] (WAGON-526) making the retry handle of http client configurable
[ https://issues.apache.org/jira/browse/WAGON-526?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16586431#comment-16586431 ] ASF GitHub Bot commented on WAGON-526: -- michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211385757 ## File path: wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/AbstractHttpClientWagonTest.java ## @@ -51,4 +79,197 @@ public void test() wagon.disconnect(); } + +@Test +public void retryableConfigurationDefaultTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationCountTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.count", "5" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 5, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationSentTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.requestSentEnabled", "true" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertTrue( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationExceptionsTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.nonRetryableClasses", IOException.class.getName() ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); + +try +{ +final Field nonRetriableClasses = handler.getClass().getSuperclass() +.getDeclaredField( "nonRetriableClasses" ); +if (!nonRetriableClasses.isAccessible()) +{ +nonRetriableClasses.setAccessible(true); +} +final Set exceptions = Set.class.cast( nonRetriableClasses.get(handler) ); +assertEquals( 1, exceptions.size() ); +assertTrue( exceptions.contains( IOException.class ) ); +} +catch ( final Exception e ) +{ +fail( e.getMessage() ); +} +} +}); +} + +private HttpRequestRetryHandler getCurrentHandler() +{ +try +{ +final Class impl = Thread.currentThread().getContextClassLoader().loadClass( +
[jira] [Commented] (WAGON-526) making the retry handle of http client configurable
[ https://issues.apache.org/jira/browse/WAGON-526?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16586434#comment-16586434 ] ASF GitHub Bot commented on WAGON-526: -- michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211385369 ## File path: wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/AbstractHttpClientWagonTest.java ## @@ -51,4 +79,197 @@ public void test() wagon.disconnect(); } + +@Test +public void retryableConfigurationDefaultTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationCountTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.count", "5" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 5, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationSentTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.requestSentEnabled", "true" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertTrue( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationExceptionsTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.nonRetryableClasses", IOException.class.getName() ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); + +try +{ +final Field nonRetriableClasses = handler.getClass().getSuperclass() +.getDeclaredField( "nonRetriableClasses" ); +if (!nonRetriableClasses.isAccessible()) +{ +nonRetriableClasses.setAccessible(true); +} +final Set exceptions = Set.class.cast( nonRetriableClasses.get(handler) ); +assertEquals( 1, exceptions.size() ); +assertTrue( exceptions.contains( IOException.class ) ); +} +catch ( final Exception e ) +{ +fail( e.getMessage() ); +} +} +}); +} + +private HttpRequestRetryHandler getCurrentHandler() +{ +try +{ +final Class impl = Thread.currentThread().getContextClassLoader().loadClass( +
[jira] [Commented] (WAGON-526) making the retry handle of http client configurable
[ https://issues.apache.org/jira/browse/WAGON-526?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16586427#comment-16586427 ] ASF GitHub Bot commented on WAGON-526: -- michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211384992 ## File path: wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/AbstractHttpClientWagonTest.java ## @@ -51,4 +79,197 @@ public void test() wagon.disconnect(); } + +@Test +public void retryableConfigurationDefaultTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationCountTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.count", "5" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 5, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationSentTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.requestSentEnabled", "true" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertTrue( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationExceptionsTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.nonRetryableClasses", IOException.class.getName() ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); + +try +{ +final Field nonRetriableClasses = handler.getClass().getSuperclass() +.getDeclaredField( "nonRetriableClasses" ); +if (!nonRetriableClasses.isAccessible()) Review comment: spaces missing This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > making the retry handle of http client configurable > --- > > Key: WAGON-526 > URL: https://issues.apache.org/jira/browse/WAGON-526 > Project: Maven Wagon > Issue Type: New Feature >Reporter: Romain Manni-Bucau >Priority: Major > > Pro
[jira] [Commented] (WAGON-526) making the retry handle of http client configurable
[ https://issues.apache.org/jira/browse/WAGON-526?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16586440#comment-16586440 ] ASF GitHub Bot commented on WAGON-526: -- michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211385725 ## File path: wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/AbstractHttpClientWagonTest.java ## @@ -51,4 +79,197 @@ public void test() wagon.disconnect(); } + +@Test +public void retryableConfigurationDefaultTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationCountTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.count", "5" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 5, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationSentTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.requestSentEnabled", "true" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertTrue( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationExceptionsTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.nonRetryableClasses", IOException.class.getName() ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); + +try +{ +final Field nonRetriableClasses = handler.getClass().getSuperclass() +.getDeclaredField( "nonRetriableClasses" ); +if (!nonRetriableClasses.isAccessible()) +{ +nonRetriableClasses.setAccessible(true); +} +final Set exceptions = Set.class.cast( nonRetriableClasses.get(handler) ); +assertEquals( 1, exceptions.size() ); +assertTrue( exceptions.contains( IOException.class ) ); +} +catch ( final Exception e ) +{ +fail( e.getMessage() ); +} +} +}); +} + +private HttpRequestRetryHandler getCurrentHandler() +{ +try +{ +final Class impl = Thread.currentThread().getContextClassLoader().loadClass( +
[jira] [Commented] (WAGON-526) making the retry handle of http client configurable
[ https://issues.apache.org/jira/browse/WAGON-526?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16586430#comment-16586430 ] ASF GitHub Bot commented on WAGON-526: -- michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211385162 ## File path: wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/AbstractHttpClientWagonTest.java ## @@ -51,4 +79,197 @@ public void test() wagon.disconnect(); } + +@Test +public void retryableConfigurationDefaultTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationCountTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.count", "5" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 5, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationSentTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.requestSentEnabled", "true" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertTrue( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationExceptionsTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.nonRetryableClasses", IOException.class.getName() ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); + +try +{ +final Field nonRetriableClasses = handler.getClass().getSuperclass() +.getDeclaredField( "nonRetriableClasses" ); +if (!nonRetriableClasses.isAccessible()) +{ +nonRetriableClasses.setAccessible(true); +} +final Set exceptions = Set.class.cast( nonRetriableClasses.get(handler) ); +assertEquals( 1, exceptions.size() ); +assertTrue( exceptions.contains( IOException.class ) ); +} +catch ( final Exception e ) +{ +fail( e.getMessage() ); +} +} +}); +} + +private HttpRequestRetryHandler getCurrentHandler() +{ +try +{ +final Class impl = Thread.currentThread().getContextClassLoader().loadClass( +
[jira] [Commented] (WAGON-526) making the retry handle of http client configurable
[ https://issues.apache.org/jira/browse/WAGON-526?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16586422#comment-16586422 ] ASF GitHub Bot commented on WAGON-526: -- michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211385140 ## File path: wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/AbstractHttpClientWagonTest.java ## @@ -51,4 +79,197 @@ public void test() wagon.disconnect(); } + +@Test +public void retryableConfigurationDefaultTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationCountTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.count", "5" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 5, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationSentTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.requestSentEnabled", "true" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertTrue( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationExceptionsTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.nonRetryableClasses", IOException.class.getName() ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); + +try +{ +final Field nonRetriableClasses = handler.getClass().getSuperclass() +.getDeclaredField( "nonRetriableClasses" ); +if (!nonRetriableClasses.isAccessible()) +{ +nonRetriableClasses.setAccessible(true); +} +final Set exceptions = Set.class.cast( nonRetriableClasses.get(handler) ); +assertEquals( 1, exceptions.size() ); +assertTrue( exceptions.contains( IOException.class ) ); +} +catch ( final Exception e ) +{ +fail( e.getMessage() ); +} +} +}); +} + +private HttpRequestRetryHandler getCurrentHandler() +{ +try +{ +final Class impl = Thread.currentThread().getContextClassLoader().loadClass( +
[jira] [Commented] (WAGON-526) making the retry handle of http client configurable
[ https://issues.apache.org/jira/browse/WAGON-526?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16586432#comment-16586432 ] ASF GitHub Bot commented on WAGON-526: -- michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211385270 ## File path: wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/AbstractHttpClientWagonTest.java ## @@ -51,4 +79,197 @@ public void test() wagon.disconnect(); } + +@Test +public void retryableConfigurationDefaultTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationCountTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.count", "5" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 5, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationSentTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.requestSentEnabled", "true" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertTrue( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationExceptionsTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.nonRetryableClasses", IOException.class.getName() ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); + +try +{ +final Field nonRetriableClasses = handler.getClass().getSuperclass() +.getDeclaredField( "nonRetriableClasses" ); +if (!nonRetriableClasses.isAccessible()) +{ +nonRetriableClasses.setAccessible(true); +} +final Set exceptions = Set.class.cast( nonRetriableClasses.get(handler) ); +assertEquals( 1, exceptions.size() ); +assertTrue( exceptions.contains( IOException.class ) ); +} +catch ( final Exception e ) +{ +fail( e.getMessage() ); +} +} +}); +} + +private HttpRequestRetryHandler getCurrentHandler() +{ +try +{ +final Class impl = Thread.currentThread().getContextClassLoader().loadClass( +
[jira] [Commented] (WAGON-526) making the retry handle of http client configurable
[ https://issues.apache.org/jira/browse/WAGON-526?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16586438#comment-16586438 ] ASF GitHub Bot commented on WAGON-526: -- michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211385831 ## File path: wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/AbstractHttpClientWagonTest.java ## @@ -51,4 +79,197 @@ public void test() wagon.disconnect(); } + +@Test +public void retryableConfigurationDefaultTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationCountTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.count", "5" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 5, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationSentTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.requestSentEnabled", "true" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertTrue( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationExceptionsTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.nonRetryableClasses", IOException.class.getName() ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); + +try +{ +final Field nonRetriableClasses = handler.getClass().getSuperclass() +.getDeclaredField( "nonRetriableClasses" ); +if (!nonRetriableClasses.isAccessible()) +{ +nonRetriableClasses.setAccessible(true); +} +final Set exceptions = Set.class.cast( nonRetriableClasses.get(handler) ); +assertEquals( 1, exceptions.size() ); +assertTrue( exceptions.contains( IOException.class ) ); +} +catch ( final Exception e ) +{ +fail( e.getMessage() ); +} +} +}); +} + +private HttpRequestRetryHandler getCurrentHandler() +{ +try +{ +final Class impl = Thread.currentThread().getContextClassLoader().loadClass( +
[jira] [Commented] (WAGON-526) making the retry handle of http client configurable
[ https://issues.apache.org/jira/browse/WAGON-526?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16586439#comment-16586439 ] ASF GitHub Bot commented on WAGON-526: -- michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211385327 ## File path: wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/AbstractHttpClientWagonTest.java ## @@ -51,4 +79,197 @@ public void test() wagon.disconnect(); } + +@Test +public void retryableConfigurationDefaultTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationCountTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.count", "5" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 5, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationSentTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.requestSentEnabled", "true" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertTrue( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationExceptionsTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.nonRetryableClasses", IOException.class.getName() ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); + +try +{ +final Field nonRetriableClasses = handler.getClass().getSuperclass() +.getDeclaredField( "nonRetriableClasses" ); +if (!nonRetriableClasses.isAccessible()) +{ +nonRetriableClasses.setAccessible(true); +} +final Set exceptions = Set.class.cast( nonRetriableClasses.get(handler) ); +assertEquals( 1, exceptions.size() ); +assertTrue( exceptions.contains( IOException.class ) ); +} +catch ( final Exception e ) +{ +fail( e.getMessage() ); +} +} +}); +} + +private HttpRequestRetryHandler getCurrentHandler() +{ +try +{ +final Class impl = Thread.currentThread().getContextClassLoader().loadClass( +
[jira] [Commented] (WAGON-526) making the retry handle of http client configurable
[ https://issues.apache.org/jira/browse/WAGON-526?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16586424#comment-16586424 ] ASF GitHub Bot commented on WAGON-526: -- michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211385112 ## File path: wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/AbstractHttpClientWagonTest.java ## @@ -51,4 +79,197 @@ public void test() wagon.disconnect(); } + +@Test +public void retryableConfigurationDefaultTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationCountTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.count", "5" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 5, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationSentTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.requestSentEnabled", "true" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertTrue( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationExceptionsTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.nonRetryableClasses", IOException.class.getName() ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); + +try +{ +final Field nonRetriableClasses = handler.getClass().getSuperclass() +.getDeclaredField( "nonRetriableClasses" ); +if (!nonRetriableClasses.isAccessible()) +{ +nonRetriableClasses.setAccessible(true); +} +final Set exceptions = Set.class.cast( nonRetriableClasses.get(handler) ); +assertEquals( 1, exceptions.size() ); +assertTrue( exceptions.contains( IOException.class ) ); +} +catch ( final Exception e ) +{ +fail( e.getMessage() ); +} +} +}); +} + +private HttpRequestRetryHandler getCurrentHandler() +{ +try +{ +final Class impl = Thread.currentThread().getContextClassLoader().loadClass( +
[jira] [Commented] (WAGON-526) making the retry handle of http client configurable
[ https://issues.apache.org/jira/browse/WAGON-526?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16586421#comment-16586421 ] ASF GitHub Bot commented on WAGON-526: -- michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211385010 ## File path: wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/AbstractHttpClientWagonTest.java ## @@ -51,4 +79,197 @@ public void test() wagon.disconnect(); } + +@Test +public void retryableConfigurationDefaultTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationCountTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.count", "5" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 5, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationSentTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.requestSentEnabled", "true" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertTrue( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationExceptionsTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.nonRetryableClasses", IOException.class.getName() ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); + +try +{ +final Field nonRetriableClasses = handler.getClass().getSuperclass() +.getDeclaredField( "nonRetriableClasses" ); +if (!nonRetriableClasses.isAccessible()) +{ +nonRetriableClasses.setAccessible(true); Review comment: space missing This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > making the retry handle of http client configurable > --- > > Key: WAGON-526 > URL: https://issues.apache.org/jira/browse/WAGON-526 > Project: Maven Wagon > Issue Type: Ne
[jira] [Commented] (WAGON-526) making the retry handle of http client configurable
[ https://issues.apache.org/jira/browse/WAGON-526?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16586435#comment-16586435 ] ASF GitHub Bot commented on WAGON-526: -- michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211385912 ## File path: wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/AbstractHttpClientWagonTest.java ## @@ -51,4 +79,197 @@ public void test() wagon.disconnect(); } + +@Test +public void retryableConfigurationDefaultTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationCountTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.count", "5" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 5, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationSentTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.requestSentEnabled", "true" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertTrue( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationExceptionsTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.nonRetryableClasses", IOException.class.getName() ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); + +try +{ +final Field nonRetriableClasses = handler.getClass().getSuperclass() +.getDeclaredField( "nonRetriableClasses" ); +if (!nonRetriableClasses.isAccessible()) +{ +nonRetriableClasses.setAccessible(true); +} +final Set exceptions = Set.class.cast( nonRetriableClasses.get(handler) ); +assertEquals( 1, exceptions.size() ); +assertTrue( exceptions.contains( IOException.class ) ); +} +catch ( final Exception e ) +{ +fail( e.getMessage() ); +} +} +}); +} + +private HttpRequestRetryHandler getCurrentHandler() +{ +try +{ +final Class impl = Thread.currentThread().getContextClassLoader().loadClass( +
[jira] [Commented] (WAGON-526) making the retry handle of http client configurable
[ https://issues.apache.org/jira/browse/WAGON-526?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16586423#comment-16586423 ] ASF GitHub Bot commented on WAGON-526: -- michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211385080 ## File path: wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/AbstractHttpClientWagonTest.java ## @@ -51,4 +79,197 @@ public void test() wagon.disconnect(); } + +@Test +public void retryableConfigurationDefaultTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationCountTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.count", "5" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 5, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationSentTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.requestSentEnabled", "true" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertTrue( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationExceptionsTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.nonRetryableClasses", IOException.class.getName() ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); + +try +{ +final Field nonRetriableClasses = handler.getClass().getSuperclass() +.getDeclaredField( "nonRetriableClasses" ); +if (!nonRetriableClasses.isAccessible()) +{ +nonRetriableClasses.setAccessible(true); +} +final Set exceptions = Set.class.cast( nonRetriableClasses.get(handler) ); +assertEquals( 1, exceptions.size() ); +assertTrue( exceptions.contains( IOException.class ) ); +} +catch ( final Exception e ) +{ +fail( e.getMessage() ); +} +} +}); +} + +private HttpRequestRetryHandler getCurrentHandler() +{ +try +{ +final Class impl = Thread.currentThread().getContextClassLoader().loadClass( +
[jira] [Commented] (WAGON-526) making the retry handle of http client configurable
[ https://issues.apache.org/jira/browse/WAGON-526?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16586425#comment-16586425 ] ASF GitHub Bot commented on WAGON-526: -- michael-o commented on a change in pull request #37: [WAGON-526] making the retry handle of http client configurable URL: https://github.com/apache/maven-wagon/pull/37#discussion_r211385200 ## File path: wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/AbstractHttpClientWagonTest.java ## @@ -51,4 +79,197 @@ public void test() wagon.disconnect(); } + +@Test +public void retryableConfigurationDefaultTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationCountTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.count", "5" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 5, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationSentTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.requestSentEnabled", "true" ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertTrue( impl.isRequestSentRetryEnabled() ); +} +}); +} + +@Test +public void retryableConfigurationExceptionsTest() throws Exception +{ +doTestHttpClient(new Runnable() +{ +@Override +public void run() +{ +System.setProperty( "maven.wagon.http.retryhandler.class", "default" ); +System.setProperty( "maven.wagon.http.retryhandler.nonRetryableClasses", IOException.class.getName() ); + +final HttpRequestRetryHandler handler = getCurrentHandler(); +assertNotNull( handler ); +assertThat( handler, instanceOf( DefaultHttpRequestRetryHandler.class ) ); +final DefaultHttpRequestRetryHandler impl = DefaultHttpRequestRetryHandler.class.cast(handler); +assertEquals( 3, impl.getRetryCount() ); +assertFalse( impl.isRequestSentRetryEnabled() ); + +try +{ +final Field nonRetriableClasses = handler.getClass().getSuperclass() +.getDeclaredField( "nonRetriableClasses" ); +if (!nonRetriableClasses.isAccessible()) +{ +nonRetriableClasses.setAccessible(true); +} +final Set exceptions = Set.class.cast( nonRetriableClasses.get(handler) ); +assertEquals( 1, exceptions.size() ); +assertTrue( exceptions.contains( IOException.class ) ); +} +catch ( final Exception e ) +{ +fail( e.getMessage() ); +} +} +}); +} + +private HttpRequestRetryHandler getCurrentHandler() +{ +try +{ +final Class impl = Thread.currentThread().getContextClassLoader().loadClass( +
[jira] [Assigned] (WAGON-526) making the retry handle of http client configurable
[ https://issues.apache.org/jira/browse/WAGON-526?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Michael Osipov reassigned WAGON-526: Assignee: Michael Osipov > making the retry handle of http client configurable > --- > > Key: WAGON-526 > URL: https://issues.apache.org/jira/browse/WAGON-526 > Project: Maven Wagon > Issue Type: New Feature >Reporter: Romain Manni-Bucau >Assignee: Michael Osipov >Priority: Major > > Provide a way to customize a lot (until a custom impl) the way wagon retries > downloads. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Updated] (WAGON-526) making the retry handle of http client configurable
[ https://issues.apache.org/jira/browse/WAGON-526?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Michael Osipov updated WAGON-526: - Fix Version/s: 3.1.1 > making the retry handle of http client configurable > --- > > Key: WAGON-526 > URL: https://issues.apache.org/jira/browse/WAGON-526 > Project: Maven Wagon > Issue Type: New Feature >Reporter: Romain Manni-Bucau >Assignee: Michael Osipov >Priority: Major > Fix For: 3.2.0 > > > Provide a way to customize a lot (until a custom impl) the way wagon retries > downloads. -- This message was sent by Atlassian JIRA (v7.6.3#76005)