Return-Path: Delivered-To: apmail-harmony-dev-archive@www.apache.org Received: (qmail 30751 invoked from network); 21 Jul 2010 05:25:35 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 21 Jul 2010 05:25:35 -0000 Received: (qmail 58155 invoked by uid 500); 21 Jul 2010 05:25:35 -0000 Delivered-To: apmail-harmony-dev-archive@harmony.apache.org Received: (qmail 57939 invoked by uid 500); 21 Jul 2010 05:25:32 -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 57930 invoked by uid 99); 21 Jul 2010 05:25:31 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 Jul 2010 05:25:31 +0000 X-ASF-Spam-Status: No, hits=3.4 required=10.0 tests=FREEMAIL_FROM,HTML_MESSAGE,HTML_OBFUSCATE_10_20,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of devyoudw@gmail.com designates 74.125.83.49 as permitted sender) Received: from [74.125.83.49] (HELO mail-gw0-f49.google.com) (74.125.83.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 Jul 2010 05:25:23 +0000 Received: by gwaa12 with SMTP id a12so3964238gwa.36 for ; Tue, 20 Jul 2010 22:24:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=9bP+geJP5rGpAQYQPWujmkmu+2uuC7yfdFDrDrEmoUE=; b=m+pMnEkMNQ6JrUBRrjiIAO+2EY8TurHOznrH0HP3OFCubAqBkI83uCv1HLQI/jaEbG 7PR2F/XfdCwkQ00uZZQ3jTzGnC/nPTTpBrK7MIS+xoI2bICBdLAPdDX8sjFyv5ili9TQ i4aP34casHQVjYq3pU1zje7alyyNzU6jzNBdQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=PQ0vqEgb7Xlkfr4uC+sniJvFDThBUWAG39Gs9Wf5TWN93OYvpES4VaNNK4n+Ticuwk QhwxOm5RBoRbFo3enTily9T4nhL+j/53dRRxn0zRroJuDOhV0tZGgs8clDR9kyuw9JwT bfCQkCMD5ZOQuZYjPSFzFWk7ayCeUTqNqpBgg= MIME-Version: 1.0 Received: by 10.100.8.11 with SMTP id 11mr7558929anh.66.1279689842635; Tue, 20 Jul 2010 22:24:02 -0700 (PDT) Received: by 10.100.110.12 with HTTP; Tue, 20 Jul 2010 22:24:02 -0700 (PDT) Date: Wed, 21 Jul 2010 13:24:02 +0800 Message-ID: Subject: [classlib][nio_cahr] Issue about CharsetEncdoer.flush() does not follow the spec and RI5 also doesn't follow the spec From: Deven You To: dev Content-Type: multipart/alternative; boundary=0016e644c70c7e3625048bdf02ef X-Virus-Checked: Checked by ClamAV on apache.org --0016e644c70c7e3625048bdf02ef Content-Type: text/plain; charset=ISO-8859-1 See https://issues.apache.org/jira/browse/HARMONY-6594 In Java5 Spec, the flush() method should always be invoked after reset() or the three-argument encode method with a value of true for the endOfInput parameter, otherwise, an IllegalStateException will be throwed. Harmony's implementation does not implement this logic, when an encoder is created and followed by calling its flush() method, flush() should throw IllegalStateException. I have fix previous case with HARMONY-6594. However I checked that RI5 also does not completely follow the spec. For the invocation sequence: reset -> encode with 3 arguments -> reset -> flush, RI5 throw IlegalStateException against the spec. (seeorg.apache.harmony.nio_char.tests.java.nio.charset.ASCIICharsetEncoderTest.testInternalState_Flushed() ) and sequence: encode(Charbuffer) -> flush(), RI5 doesn't throw IlegalStateException against the spec. (after encode(Charbuffer), the encoder should be in FLUSH state) (see seeorg.apache.harmony.nio_char.tests.java.nio.charset.ASCIICharsetEncoderTest.testInternalState_from_Encode) Further Investigation shows from Java6 Spec, this behavior is changed, it says flush() will throw IllegalStateException if the previous step of the current encoding operation was an invocation neither of the flush method nor of the three-argument encode method with a value of true for the endOfInput parameter. And actually, RI5 follows the java6 spec rather than java5! So now I am confused if we should modify our harmony trunk CharsetEncoder to comply with the java5 spec or in other hand modify it to comply with RI5 and java6 spec for above 2 cases? Anyone could give me some suggestions for this point? --0016e644c70c7e3625048bdf02ef--