Return-Path: Delivered-To: apmail-tapestry-dev-archive@www.apache.org Received: (qmail 8309 invoked from network); 28 May 2009 00:23:57 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 28 May 2009 00:23:57 -0000 Received: (qmail 54859 invoked by uid 500); 28 May 2009 00:24:09 -0000 Delivered-To: apmail-tapestry-dev-archive@tapestry.apache.org Received: (qmail 54774 invoked by uid 500); 28 May 2009 00:24:09 -0000 Mailing-List: contact commits-help@tapestry.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@tapestry.apache.org Delivered-To: mailing list commits@tapestry.apache.org Received: (qmail 54754 invoked by uid 99); 28 May 2009 00:24:07 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 May 2009 00:24:07 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 May 2009 00:24:05 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 8B40F234C004 for ; Wed, 27 May 2009 17:23:45 -0700 (PDT) Message-ID: <1410033600.1243470225555.JavaMail.jira@brutus> Date: Wed, 27 May 2009 17:23:45 -0700 (PDT) From: "Lukasz Jazgar (JIRA)" To: commits@tapestry.apache.org Subject: [jira] Updated: (TAP5-725) Last translator in configuration becomes default translator In-Reply-To: <1538044419.1243470105620.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/TAP5-725?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Lukasz Jazgar updated TAP5-725: ------------------------------- Attachment: TrimTranslator.java > Last translator in configuration becomes default translator > ----------------------------------------------------------- > > Key: TAP5-725 > URL: https://issues.apache.org/jira/browse/TAP5-725 > Project: Tapestry 5 > Issue Type: Bug > Components: tapestry-core > Affects Versions: 5.1.0.5 > Reporter: Lukasz Jazgar > Attachments: TrimTranslator.java > > > I've created simple translator TrimTranslator, which works on String fields. It is same as StringTranslator. Only difference is it removes all white spaces at beginning and end of string. I will attach java source file of it. > When I've contributed this translator to TranslatorSource service, new translator became default for type String. Every string value incoming from client is now trimmed. It's wrong. I expect new translator will work only when I explicitly declare it for form field component. > As I see, historically (more than 1 year ago) there was 2 distinct services TranslatorSource and TranslatorDefaultSource. It was clear. > Later they was joined to one. Why? Current TranslatorSource works fine only if there is one translator for every type or we want to override default translator. There is no possibility to create new alternative translators. > Proposal of resolution: > Maybe default translators for type should be distinguished by it's name property, which is unique, not only type? > Default translators should have name same as name of type. So, "string" is default for java.lang.String, "boolean" is default for java.lang.Boolean, and so on. Any other like "trim" or "yesno" (example in jumpstart app) should need explicit declaration. > It boils down to replacing in constructor of TranslatorSourceImpl: > typeToTranslator.put(t.getType(), t); > with: > if (t.getType().getSimpleName().equalsIgnoreCase(t.getName()) { > typeToTranslator.put(t.getType(), t); > } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.