From dev-return-68365-archive-asf-public=cust-asf.ponee.io@zookeeper.apache.org Mon Mar 26 04:05:06 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 7B9E818063B for ; Mon, 26 Mar 2018 04:05:05 +0200 (CEST) Received: (qmail 87076 invoked by uid 500); 26 Mar 2018 02:05:04 -0000 Mailing-List: contact dev-help@zookeeper.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@zookeeper.apache.org Delivered-To: mailing list dev@zookeeper.apache.org Received: (qmail 87065 invoked by uid 99); 26 Mar 2018 02:05:04 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Mar 2018 02:05:04 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 7BB781A045D for ; Mon, 26 Mar 2018 02:05:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -101.511 X-Spam-Level: X-Spam-Status: No, score=-101.511 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id 8oJm3m_iRChv for ; Mon, 26 Mar 2018 02:05:02 +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 C66EF5FACE for ; Mon, 26 Mar 2018 02:05:01 +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 AFCEBE0147 for ; Mon, 26 Mar 2018 02:05:00 +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 21EBC214F6 for ; Mon, 26 Mar 2018 02:05:00 +0000 (UTC) Date: Mon, 26 Mar 2018 02:05:00 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: dev@zookeeper.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (ZOOKEEPER-3006) Potential NPE in ZKDatabase#calculateTxnLogSizeLimit MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/ZOOKEEPER-3006?page=3Dcom.atlas= sian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D= 16413274#comment-16413274 ]=20 ASF GitHub Bot commented on ZOOKEEPER-3006: ------------------------------------------- Github user hanm commented on the issue: https://github.com/apache/zookeeper/pull/493 =20 @edwardoliveira : could you please share your email so I can put it in = commit message when merge this?=20 Also, could you please create a JIRA account if you don't have one on h= ttps://issues.apache.org/jira/projects/ZOOKEEPER so I can assign ZOOKEEPER-= 3006 to you? This is to make sure we distribute commit credits to contribut= ors. > Potential NPE in ZKDatabase#calculateTxnLogSizeLimit > ---------------------------------------------------- > > Key: ZOOKEEPER-3006 > URL: https://issues.apache.org/jira/browse/ZOOKEEPER-3006 > Project: ZooKeeper > Issue Type: Bug > Affects Versions: 3.6.0 > Reporter: lujie > Priority: Major > > I have found a=C2=A0potential NPE in=C2=A0ZKDatabase#calculateTxnLogSizeL= imit: > =C2=A0 > {code:java} > //ZKDatabase > public long calculateTxnLogSizeLimit() { > long snapSize =3D 0; > try { > snapSize =3D snapLog.findMostRecentSnapshot().length(); > } catch (IOException e) { > LOG.error("Unable to get size of most recent snapshot"); > } > return (long) (snapSize * snapshotSizeFactor); > } > {code} > =C2=A0in=C2=A0FileTxnSnapLog#findMostRecentSnapshot(), it will return the= result of=C2=A0 FileSnap#findMostRecentSnapshot: > {code:java} > // called by FileTxnSnapLog#findMostRecentSnapshot() > public File findMostRecentSnapshot() throws IOException { > List files =3D findNValidSnapshots(1); > if (files.size() =3D=3D 0) { > return null; > } > return files.get(0); > } > {code} > So it will return null when the files sizes is 0, but ZKDatabase#calculat= eTxnLogSizeLimit has no null checker > =C2=A0 > =C2=A0 -- This message was sent by Atlassian JIRA (v7.6.3#76005)