Skip to content

another NPE in ApacheHttpClientApiAdapter#getHostName #4263

@kamilkulczyk

Description

@kamilkulczyk

I found out that there is another issue related to this getHostName() method (#3478)

I'm on a version 1.52.1 (this was fixed in 1.46.0) and have another null exception here.

if (httpHost != null) {
    return httpHost.getHostName();
}

try {
    return RoutingSupport.determineHost(request)
        .getHostName();
} catch (HttpException e) {
    logger.error("Exception while determining HostName", e);

    return null;
}

there is no catch for NPE in the try statement. This hasn't changed since then, so you may find it as a bug.

Stacktrace

java.lang.NullPointerException: Cannot invoke "org.apache.hc.core5.http.HttpHost.getHostName()" because the return value of "org.apache.hc.client5.http.routing.RoutingSupport.determineHost(org.apache.hc.core5.http.HttpRequest)" is null`

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions