From patchwork Sun Aug 7 11:00:38 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Liu X-Patchwork-Id: 108814 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id B0A1DB6F65 for ; Sun, 7 Aug 2011 21:00:55 +1000 (EST) Received: (qmail 13078 invoked by alias); 7 Aug 2011 11:00:53 -0000 Received: (qmail 13062 invoked by uid 22791); 7 Aug 2011 11:00:53 -0000 X-SWARE-Spam-Status: No, hits=-0.0 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, TW_GC, T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-yw0-f47.google.com (HELO mail-yw0-f47.google.com) (209.85.213.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 07 Aug 2011 11:00:39 +0000 Received: by ywe9 with SMTP id 9so2548905ywe.20 for ; Sun, 07 Aug 2011 04:00:39 -0700 (PDT) MIME-Version: 1.0 Received: by 10.236.201.200 with SMTP id b48mr5289745yho.77.1312714839006; Sun, 07 Aug 2011 04:00:39 -0700 (PDT) Received: by 10.147.82.10 with HTTP; Sun, 7 Aug 2011 04:00:38 -0700 (PDT) In-Reply-To: References: Date: Sun, 7 Aug 2011 19:00:38 +0800 Message-ID: Subject: Re: [PATCH] [JAVA] Double.parseDouble(null) throw NullPointerException From: Jie Liu To: gcc-patches@gcc.gnu.org, java-patches@gcc.gnu.org X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Hi, When I use gcj on an RTOS(RTEMS), Double.parseDouble(null) throw NumberFormatException, but it should throw NullPointerException. So I add the patch below: The testsuite/Throw_2.java has been PASS after this patch. what do you think about this patch? Thanks, Jie Index: natVMDouble.cc =================================================================== --- natVMDouble.cc (revision 172224) +++ natVMDouble.cc (working copy) @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -162,6 +163,9 @@ jdouble java::lang::VMDouble::parseDouble(jstring str) { + if(str == NULL) + throw new NullPointerException(); + int length = str->length(); while (length > 0