Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-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 929A8183DC for ; Wed, 19 Aug 2015 23:23:46 +0000 (UTC) Received: (qmail 15500 invoked by uid 500); 19 Aug 2015 23:23:46 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 15407 invoked by uid 500); 19 Aug 2015 23:23:46 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 15393 invoked by uid 99); 19 Aug 2015 23:23:45 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Aug 2015 23:23:45 +0000 Date: Wed, 19 Aug 2015 23:23:45 +0000 (UTC) From: "Sebb (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (BCEL-249) Check for max Short seems wrong MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 Sebb created BCEL-249: ------------------------- Summary: Check for max Short seems wrong Key: BCEL-249 URL: https://issues.apache.org/jira/browse/BCEL-249 Project: Commons BCEL Issue Type: Bug Reporter: Sebb There are some checks for the max value that will fit in a short. These are of the form: {code} if (Math.abs(value) >= 32767) {code} This seems wrong, as Short.MAX_VALUE = 32767, so the check should be {code} if (Math.abs(value) > 32767) {code} There's a further problem, which is that Short.MIN_VALUE = -32768. This will be disallowed, unless the condition is written as: {code} if ((value >= -32768) && (value <= 32767)) {code} This is how the ctor generic.PUSH.PUSH(ConstantPoolGen cp, int value) does the check. -- This message was sent by Atlassian JIRA (v6.3.4#6332)