Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 8CAD7200BBB for ; Wed, 26 Oct 2016 12:04:03 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 8B55F160ACA; Wed, 26 Oct 2016 10:04:03 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id D4145160AEE for ; Wed, 26 Oct 2016 12:04:02 +0200 (CEST) Received: (qmail 75880 invoked by uid 500); 26 Oct 2016 10:03:58 -0000 Mailing-List: contact dev-help@hc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "HttpComponents Project" Delivered-To: mailing list dev@hc.apache.org Received: (qmail 75566 invoked by uid 99); 26 Oct 2016 10:03:58 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Oct 2016 10:03:58 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 74D162C0D55 for ; Wed, 26 Oct 2016 10:03:58 +0000 (UTC) Date: Wed, 26 Oct 2016 10:03:58 +0000 (UTC) From: "Adam Michalik (JIRA)" To: dev@hc.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (HTTPCORE-437) NullPointerException in HeaderGroup.getHeaders MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Wed, 26 Oct 2016 10:04:03 -0000 [ https://issues.apache.org/jira/browse/HTTPCORE-437?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Adam Michalik updated HTTPCORE-437: ----------------------------------- Environment: Oracle JDK 8u101 on Ubuntu 14.04 > NullPointerException in HeaderGroup.getHeaders > ---------------------------------------------- > > Key: HTTPCORE-437 > URL: https://issues.apache.org/jira/browse/HTTPCORE-437 > Project: HttpComponents HttpCore > Issue Type: Bug > Components: HttpCore > Affects Versions: 4.4.5 > Environment: Oracle JDK 8u101 on Ubuntu 14.04 > Reporter: Adam Michalik > > I'm using HttpClient in multithreaded environment with PoolingHttpClientConnectionManager. Once in a while I get an exception whose root cause is > {code} > Caused by: java.lang.NullPointerException: null > at org.apache.http.message.HeaderGroup.getHeaders(HeaderGroup.java:182) > at org.apache.http.message.AbstractHttpMessage.getHeaders(AbstractHttpMessage.java:73) > at org.apache.http.impl.client.DefaultClientConnectionReuseStrategy.keepAlive(DefaultClientConnectionReuseStrategy.java:51) > at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:274) > at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184) > at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88) > at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110) > at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184) > at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:71) > at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:220) > at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:164) > {code} > The {{getHeaders}} method is > {code:java} > public Header[] getHeaders(final String name) { > List
headersFound = null; > for (int i = 0; i < this.headers.size(); i++) { > final Header header = this.headers.get(i); > if (header.getName().equalsIgnoreCase(name)) { // NPE HERE > if (headersFound == null) { > headersFound = new ArrayList
(); > } > headersFound.add(header); > } > } > return headersFound != null ? headersFound.toArray(new Header[headersFound.size()]) : EMPTY; > } > {code} > I looked around in the {{HeaderGroup}} class and I see that every modification to the {{headers}} list has a null-check. Also, the {{BasicHeader}} and {{BufferedHeader}} have null-checks so that {{name}} cannot be null. How can this be occurring? > The issue happens on production, around 10 exceptions in the last 12 hours out of 1 000 000 requests done in total. -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org For additional commands, e-mail: dev-help@hc.apache.org