You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Jonathan Yan (Jira)" <ji...@apache.org> on 2025/12/24 10:57:00 UTC

[jira] [Created] (HTTPCLIENT-2410) NullPointerException when building HttpClient with evictExpiredConnections

Jonathan Yan created HTTPCLIENT-2410:
----------------------------------------

             Summary: NullPointerException when building HttpClient with evictExpiredConnections
                 Key: HTTPCLIENT-2410
                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2410
             Project: HttpComponents HttpClient
          Issue Type: Bug
          Components: HttpClient (async), HttpClient (classic)
    Affects Versions: 5.6
            Reporter: Jonathan Yan
         Attachments: Issue.java

When calling the {{build()}} method on an instance of {{{{{}HttpClient{}}}Builder}} configured with {{evictExpiredConnections}} but not {{{}evictIdleConnections{}}}, a {{NullPointerException}} is thrown. Here is an example stacktrace:
{code:java}
Exception in thread "main" java.lang.NullPointerException: Cannot invoke "org.apache.hc.core5.util.TimeValue.divide(long, java.util.concurrent.TimeUnit)" because "this.maxIdleTime" is null
    at org.apache.hc.client5.http.impl.classic.HttpClientBuilder.build(HttpClientBuilder.java:1118)
    at Issue.main(Issue.java:7){code}
The issue can be reproduced with the attached file using {{{}org.apache.httpcomponents.client5:httpclient5:5.6{}}}.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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