Return-Path: X-Original-To: apmail-commons-dev-archive@www.apache.org Delivered-To: apmail-commons-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E87E94A09 for ; Sun, 3 Jul 2011 21:05:14 +0000 (UTC) Received: (qmail 61173 invoked by uid 500); 3 Jul 2011 21:05:14 -0000 Delivered-To: apmail-commons-dev-archive@commons.apache.org Received: (qmail 61016 invoked by uid 500); 3 Jul 2011 21:05:13 -0000 Mailing-List: contact dev-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Developers List" Delivered-To: mailing list dev@commons.apache.org Received: (qmail 61008 invoked by uid 99); 3 Jul 2011 21:05:13 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 03 Jul 2011 21:05:13 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of garydgregory@gmail.com designates 209.85.161.52 as permitted sender) Received: from [209.85.161.52] (HELO mail-fx0-f52.google.com) (209.85.161.52) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 03 Jul 2011 21:05:06 +0000 Received: by fxd18 with SMTP id 18so4172923fxd.39 for ; Sun, 03 Jul 2011 14:04:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=references:from:in-reply-to:mime-version:date:message-id:subject:to :content-type:content-transfer-encoding; bh=C2t33G/Y/Xst5OWueN7JPP72rSyZ2L/z0hQjWBNWwp4=; b=GzMjfXYkR2taywzJ4aKTqohluHjkrurX4cKhUqKAHNX8V15y83BK7Exm2VPb94SHiz srdI5Wmw3084TAyiPPKuATpxEMDul7DBvdzuBwyBe8UqId/AA5kwwfHJOQrjdhqoTr0A 0YNFnfdOPctuKC9mc6KXv8dCfAaryyC6BWQMg= Received: by 10.223.98.141 with SMTP id q13mr8344380fan.96.1309727086352; Sun, 03 Jul 2011 14:04:46 -0700 (PDT) References: <22663375.292.1309714793287.JavaMail.mobile-sync@bfkl35> From: Gary Gregory In-Reply-To: <22663375.292.1309714793287.JavaMail.mobile-sync@bfkl35> Mime-Version: 1.0 (iPhone Mail 8J2) Date: Sun, 3 Jul 2011 17:04:42 -0400 Message-ID: <2093547918556106576@unknownmsgid> Subject: Re: [lang] Time for RC3? To: Commons Developers List Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org On Jul 3, 2011, at 13:39, Oliver Heger wrote= : > Hi J=C3=B6rg, > > Am 02.07.2011 16:28, schrieb J=C3=B6rg Schaible: >> Hi, >> >> Henri Yandell wrote: >> >>> These are the current blocking items in play afaik: >>> >>> * Email thread - what else should implement Formattable? I would look at this differently to get 3.0 out the door: Let's make sure we do not make anything Formattable that we might have to back out later. Gary >>> * LANG-696/Email thread - getShortName. What to do with the (String) >>> variant. Remove others. >>> * Email thread - Validate method naming >> >> Can somebody else give the ContextedException stuff a review? I used in = the >> meanwhile a copy of it in a project, but a method name is bugging me. >> >> What's it about? The exception provides a context for additional >> information, just think of a map with key/value pairs. The problem that = it >> solves: >> >> Instead of writing: >> >> throw new MyCommunicationException("The connection to " + host + ':' + p= ort >> + " failed for " + user + " because of invalid credentials"); >> >> you have: >> >> throw new MyCommunicationException("Invalid credentials for >> connection").addValue("host", host).addValue("port", port).addValue("use= r", >> user); >> >> And you're able to enrich the context in a bigger scope: >> >> try { >> ... >> } (catch MyCommunicationException e) { >> throw e.addValue("Module", "backup"); >> } >> >> Fine so far. The values are properly formatted in table form in case of = a >> message and you may even access the individual values. A problem arises = in >> recursive algorithms (e.g. SAX Handler) with: >> >> try { >> ... >> } (catch MyException e) { >> throw e.addValue("Current Handler", handler.class.getName()) >> .addValue("Current Line", line); >> } >> >> This would normally clobber the "Current Handler" in a nested handler >> situation. Our implementation will therefore detect the key clash and ad= d >> the new value with key "Current Handler[1]" (and will increase the index= for >> more values). However, the current line in the processed XML is always t= he >> same and does not change, but would be added over and over again for eac= h >> recursive step. >> >> Therefore the ExceptionContext defines the method "replaceValue(key, val= ue)" >> ... and this is bugging me, since for me it is "setValue(key, value)". >> Typically *I* would use setValue for the normal case and only in recursi= ve >> situations addValue. Can somebody review this interface and also the met= hod >> documentation, because *I* have a clear idea what add/set should do, but= the >> method description gives a lot of possibilities about its purpose and ho= w it >> can be implemented. What do you think about this API? > > I tend to agree with your arguments. At least I think that > implementations would behave in a more predictable way if the > documentation was clearer. Statements like "it depends on the > implementation what happens with the new value" are not that helpful. > > For addProperty() I would even expect that if multiple values with the > same key are added, a collection is created. This seems more natural to > me than automatically creating keys with indices. > > Oliver > >> >> Cheers, >> J=C3=B6rg >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org >> For additional commands, e-mail: dev-help@commons.apache.org >> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org > For additional commands, e-mail: dev-help@commons.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org For additional commands, e-mail: dev-help@commons.apache.org