Return-Path: X-Original-To: apmail-hadoop-common-issues-archive@minotaur.apache.org Delivered-To: apmail-hadoop-common-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 680E118CDF for ; Wed, 24 Jun 2015 20:20:05 +0000 (UTC) Received: (qmail 71280 invoked by uid 500); 24 Jun 2015 20:20:05 -0000 Delivered-To: apmail-hadoop-common-issues-archive@hadoop.apache.org Received: (qmail 71234 invoked by uid 500); 24 Jun 2015 20:20:05 -0000 Mailing-List: contact common-issues-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: common-issues@hadoop.apache.org Delivered-To: mailing list common-issues@hadoop.apache.org Received: (qmail 71208 invoked by uid 99); 24 Jun 2015 20:20:05 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 Jun 2015 20:20:05 +0000 Date: Wed, 24 Jun 2015 20:20:05 +0000 (UTC) From: "zhihai xu (JIRA)" To: common-issues@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (HADOOP-12117) Potential NPE from Configuration#loadProperty with allowNullValueProperties set. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/HADOOP-12117?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14600075#comment-14600075 ] zhihai xu commented on HADOOP-12117: ------------------------------------ I uploaded a patch HADOOP-12117.000.patch for review, the patch will set {{value}} before access it and also checking {{allowNullValueProperties}} is not necessary inside {{if}} statement, because {{allowNullValueProperties}} will guarantee being true if {{value}} is null. > Potential NPE from Configuration#loadProperty with allowNullValueProperties set. > -------------------------------------------------------------------------------- > > Key: HADOOP-12117 > URL: https://issues.apache.org/jira/browse/HADOOP-12117 > Project: Hadoop Common > Issue Type: Bug > Components: conf > Affects Versions: 2.7.1 > Reporter: zhihai xu > Assignee: zhihai xu > Attachments: HADOOP-12117.000.patch > > > Potential NPE from Configuration#loadProperty with allowNullValueProperties set. > The following code will cause NPE: > {code} > } else if (!value.equals(properties.getProperty(attr))) { > {code} > Because if {{allowNullValueProperties}} is true, {{value}} is null and {{finalParameters}} contains {{attr}}, NullPointerException will happen -- This message was sent by Atlassian JIRA (v6.3.4#6332)