Return-Path: Delivered-To: apmail-harmony-dev-archive@www.apache.org Received: (qmail 74058 invoked from network); 13 May 2009 09:35:25 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 13 May 2009 09:35:25 -0000 Received: (qmail 83182 invoked by uid 500); 13 May 2009 09:35:24 -0000 Delivered-To: apmail-harmony-dev-archive@harmony.apache.org Received: (qmail 83126 invoked by uid 500); 13 May 2009 09:35:24 -0000 Mailing-List: contact dev-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list dev@harmony.apache.org Received: (qmail 83115 invoked by uid 99); 13 May 2009 09:35:24 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 May 2009 09:35:24 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of oliver.deakin@googlemail.com designates 209.85.219.158 as permitted sender) Received: from [209.85.219.158] (HELO mail-ew0-f158.google.com) (209.85.219.158) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 May 2009 09:35:13 +0000 Received: by ewy2 with SMTP id 2so587906ewy.36 for ; Wed, 13 May 2009 02:34:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=YNvuShXIowQ7CIr8xAk6helW0/JGDKyxSp0GItbQD+8=; b=Zs8rRWCPgKMIzexTdPMCOJNA5anwYpO/rWEpjb1RXPS3V2JlufMtoMUY80SzS+B7Fs GNETTnHaRpNuZpR3pJBkNcfWV4eMn9OJ9zqas3CQXZ8hDZgLYCn1jU+jjW/oB0+4ma8w A3zfwcR9Fb+8Dfwmc0sXPWxcjdXXLVKcL0x6A= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; b=LSQGhnKeFuQXAJw43gwaVA6SIXCa1E812QJAkL3dzkfhx+tRhIaPcjeGVqGbab/U3V wnmVSb9cQ4hSXxpkFPhC6NL/0EVZ90l/ZxJVkxeWL3PfNaeSouvHReNwpJJNKrwIdrwM CzBtQHbg3WXqFtuwtYLbb4jCYmXI1JCgRyz+4= Received: by 10.210.20.17 with SMTP id 17mr929013ebt.38.1242207291568; Wed, 13 May 2009 02:34:51 -0700 (PDT) Received: from ?9.180.164.202? (blueice2n1.uk.ibm.com [195.212.29.75]) by mx.google.com with ESMTPS id 5sm2192068eyf.28.2009.05.13.02.34.50 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 13 May 2009 02:34:50 -0700 (PDT) Message-ID: <4A0A9439.2020403@googlemail.com> Date: Wed, 13 May 2009 10:34:49 +0100 From: Oliver Deakin User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 To: dev@harmony.apache.org Subject: Re: svn commit: r773966 - /harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/OSFileSystem.java References: <20090512162308.680E823889DE@eris.apache.org> <3b3f27c60905121815o3c5c8946yc6b2ddbdb1fadae1@mail.gmail.com> In-Reply-To: <3b3f27c60905121815o3c5c8946yc6b2ddbdb1fadae1@mail.gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Nathan Beyer wrote: > This commit seems contradictory to the specification. All JREs must > support UTF-8 as an encoding, so the UnsupportedEncodingException > should never happen. > > I think the code should throw new AssertionError(e) in the catch block. > I'm not sure I'd call it contradictory to the spec - the exception needs to be caught as it is declared by the String constructor being called, whether it should happen or not. How it is handled is up to us - perhaps an AssertionError would be better here to indicate that we have entered a code block that should be unreachable. I don't feel strongly either way so am happy to go with whatever the consensus feeling on this is. Regards, Oliver > Thoughts? > > -Nathan > > On Tue, May 12, 2009 at 11:23 AM, wrote: > >> Author: odeakin >> Date: Tue May 12 16:23:08 2009 >> New Revision: 773966 >> >> URL: http://svn.apache.org/viewvc?rev=773966&view=rev >> Log: >> When constructing the exception, make sure the error message is in an encoding where it will be readable on non-ASCII platforms once printed. >> >> Modified: >> harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/OSFileSystem.java >> >> Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/OSFileSystem.java >> URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/OSFileSystem.java?rev=773966&r1=773965&r2=773966&view=diff >> ============================================================================== >> --- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/OSFileSystem.java (original) >> +++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/OSFileSystem.java Tue May 12 16:23:08 2009 >> @@ -20,6 +20,7 @@ >> import java.io.FileDescriptor; >> import java.io.FileNotFoundException; >> import java.io.IOException; >> +import java.io.UnsupportedEncodingException; >> >> /** >> * This is the portable implementation of the file system interface. >> @@ -235,7 +236,11 @@ >> } >> long handler = openImpl(fileName, mode); >> if (handler < 0) { >> - throw new FileNotFoundException(new String(fileName)); >> + try { >> + throw new FileNotFoundException(new String(fileName, "UTF-8")); >> + } catch (java.io.UnsupportedEncodingException e) { >> + throw new FileNotFoundException(new String(fileName)); >> + } >> } >> return handler; >> } >> >> >> >> > > -- Oliver Deakin Unless stated otherwise above: IBM United Kingdom Limited - Registered in England and Wales with number 741598. Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU