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 00259200C79 for ; Fri, 5 May 2017 01:59:10 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id F2E9C160BB0; Thu, 4 May 2017 23:59:09 +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 45259160BC4 for ; Fri, 5 May 2017 01:59:09 +0200 (CEST) Received: (qmail 90700 invoked by uid 500); 4 May 2017 23:59:07 -0000 Mailing-List: contact common-dev-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list common-dev@hadoop.apache.org Received: (qmail 90494 invoked by uid 99); 4 May 2017 23:59:07 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 04 May 2017 23:59:07 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 588D8C031B for ; Thu, 4 May 2017 23:59:07 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -100.002 X-Spam-Level: X-Spam-Status: No, score=-100.002 tagged_above=-999 required=6.31 tests=[RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id zLZWh3QFfOWB for ; Thu, 4 May 2017 23:59:06 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 105255F665 for ; Thu, 4 May 2017 23:59:06 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 2B676E0234 for ; Thu, 4 May 2017 23:59:05 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 7273621DEA for ; Thu, 4 May 2017 23:59:04 +0000 (UTC) Date: Thu, 4 May 2017 23:59:04 +0000 (UTC) From: "Wei-Chiu Chuang (JIRA)" To: common-dev@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (HADOOP-14385) HttpExceptionUtils#validateResponse hides exceptions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Thu, 04 May 2017 23:59:10 -0000 Wei-Chiu Chuang created HADOOP-14385: ---------------------------------------- Summary: HttpExceptionUtils#validateResponse hides exceptions Key: HADOOP-14385 URL: https://issues.apache.org/jira/browse/HADOOP-14385 Project: Hadoop Common Issue Type: Improvement Reporter: Wei-Chiu Chuang Assignee: Wei-Chiu Chuang In the following code {code:title=HttpExceptionUtils#validateResponse} try { es = conn.getErrorStream(); ObjectMapper mapper = new ObjectMapper(); Map json = mapper.readValue(es, Map.class); json = (Map) json.get(ERROR_JSON); String exClass = (String) json.get(ERROR_CLASSNAME_JSON); String exMsg = (String) json.get(ERROR_MESSAGE_JSON); if (exClass != null) { try { ClassLoader cl = HttpExceptionUtils.class.getClassLoader(); Class klass = cl.loadClass(exClass); Constructor constr = klass.getConstructor(String.class); toThrow = (Exception) constr.newInstance(exMsg); } catch (Exception ex) { toThrow = new IOException(String.format( "HTTP status [%d], exception [%s], message [%s] ", conn.getResponseCode(), exClass, exMsg)); } } else { String msg = (exMsg != null) ? exMsg : conn.getResponseMessage(); toThrow = new IOException(String.format( "HTTP status [%d], message [%s]", conn.getResponseCode(), msg)); } } catch (Exception ex) { toThrow = new IOException(String.format( <-- here "HTTP status [%d], message [%s]", conn.getResponseCode(), conn.getResponseMessage())); } {code} If the an exception is thrown within the try block, the initial exception is swallowed, and it doesn't help debugging. We had to cross reference this exception with the KMS server side to guess what happened. IMHO the IOException thrown should also carry the initial exception. It should also print exClass and exMsg. It probably failed to instantiate an exception class. -- This message was sent by Atlassian JIRA (v6.3.15#6346) --------------------------------------------------------------------- To unsubscribe, e-mail: common-dev-unsubscribe@hadoop.apache.org For additional commands, e-mail: common-dev-help@hadoop.apache.org