Return-Path: Delivered-To: apmail-incubator-harmony-dev-archive@www.apache.org Received: (qmail 3187 invoked from network); 5 Sep 2006 07:31:31 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 5 Sep 2006 07:31:31 -0000 Received: (qmail 90123 invoked by uid 500); 5 Sep 2006 07:31:24 -0000 Delivered-To: apmail-incubator-harmony-dev-archive@incubator.apache.org Received: (qmail 90087 invoked by uid 500); 5 Sep 2006 07:31:24 -0000 Mailing-List: contact harmony-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: harmony-dev@incubator.apache.org Delivered-To: mailing list harmony-dev@incubator.apache.org Received: (qmail 90076 invoked by uid 99); 5 Sep 2006 07:31:24 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Sep 2006 00:31:24 -0700 X-ASF-Spam-Status: No, hits=0.5 required=10.0 tests=DNS_FROM_RFC_ABUSE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of dkishenko@gmail.com designates 64.233.166.176 as permitted sender) Received: from [64.233.166.176] (HELO py-out-1112.google.com) (64.233.166.176) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Sep 2006 00:31:23 -0700 Received: by py-out-1112.google.com with SMTP id f25so2666655pyf for ; Tue, 05 Sep 2006 00:31:03 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=MPvxGLNfhgeNYC/XNgx0o3gOdiHjlGHPa8DfZxTEUnAaP8ceHqI1YT7tozuFfTMpxzQA1CiQYd1PvqhIPixIt+55P9sb4Z6Mcd3AmxauD77DgxKVKIz1D5jirb85rYpD8Xa7ufZyYzWuz39esek+CXVXfT22J+Fe2/tF11njL74= Received: by 10.35.65.17 with SMTP id s17mr9478574pyk; Tue, 05 Sep 2006 00:31:03 -0700 (PDT) Received: by 10.35.73.14 with HTTP; Tue, 5 Sep 2006 00:31:03 -0700 (PDT) Message-ID: <834b3bd50609050031i2535677bta31730268122b8e6@mail.gmail.com> Date: Tue, 5 Sep 2006 11:31:03 +0400 From: "Denis Kishenko" To: harmony-dev@incubator.apache.org Subject: Re: [classlib][security] Exception compatibility In-Reply-To: <6e47b64f0609042102m7884c5c3q1af6e8b3b52a2c1e@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <6e47b64f0609042102m7884c5c3q1af6e8b3b52a2c1e@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Boris thank you for your question. I asked myself the same question and choose the same answer as you. Unfortunately as people wrote above we were wrong and they are reasonable. I have already written patch for HARMONY-1120 to follow RI behavior. 2006/9/5, Stepan Mishura : > On 9/4/06, Boris Kuznetsov wrote: > > > > Usually Harmony behavior is compared with RI behavior. But in security > > area RI behavior depends on provider. With different providers RI > > behave differently. > > > > For example, RI passes incorrect method arguments to provider. In such > > cases provider may throw exception (e.g. DigestException or > > IllegalArgumentException) or some RuntimeException (e.g. > > ArrayIndexOutOfBoundsException) may be thrown during the execution. > > Here is example. > > > > There are number of methods with arguments like (byte[] buf, int > > offset, int len). RI doesn't check if offset and len are negative but > > Harmony does, so we have difference in behavior (see Harmony-1120, > > 1148): on combination RI + provider application gets provider specific > > exception, but on Harmony + provider - IllegalArgumentException (as in > > other invalid parameters cases). > > > > So we have two options: > > 1. Fix Harmony (remove negative parameters checks) > > 2. Don't fix. Throw IllegalArgumentException for invalid parameters. > > Document as non-bug difference from RI. > > > Hi, Boris. > > We agreed to be exceptions-compatible with RI so we would have chosen the > first option. But I think that the first option is not suitable. I'll try to > explain why. I have a look at MessageDigest.java and mentioned JIRAs: so > there are 4 cases when parameters are invalid and an implementation has to > check if: > 1) buf - is null > 2) offset < 0 > 3) len < 0 > 4) offset + len > buf's len > > The first option means that we have to remove 2 and 3 checks. And leave 1 > and 4 as RI does. But 4 check is meaningless without 2 and 3. IOW, it is > only valid if offset and len params are correct. IMO chosing the first > option is copying inconsistent behaviour. So I vote for the second option. > > Thanks, > Stepan. > > Note, specification doesn't describe implementation behavior for > > invalid arguments, but RI also throws IllegalArgumentException if > > ofsset+len > buf.length. So throwing of IllegalArgumentException in > > Harmony can't break any application. > > > > I suggest option 2. > > Thoughts? > > > > Thanks, > > Boris > > > > ------------------------------------------------------ > Terms of use : http://incubator.apache.org/harmony/mailing.html > To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org > For additional commands, e-mail: harmony-dev-help@incubator.apache.org > > -- Denis M. Kishenko Intel Middleware Products Division --------------------------------------------------------------------- Terms of use : http://incubator.apache.org/harmony/mailing.html To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org For additional commands, e-mail: harmony-dev-help@incubator.apache.org