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 0D9AE967F for ; Thu, 2 Feb 2012 13:21:52 +0000 (UTC) Received: (qmail 46226 invoked by uid 500); 2 Feb 2012 13:21:52 -0000 Delivered-To: apmail-commons-dev-archive@commons.apache.org Received: (qmail 46024 invoked by uid 500); 2 Feb 2012 13:21:51 -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 Delivered-To: moderator for dev@commons.apache.org Received: (qmail 9336 invoked by uid 99); 2 Feb 2012 03:13:21 -0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of adamkudla@gmail.com designates 209.85.214.43 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=pRKQZtLhZ3pN92Veu3jvbRYDBnhCd0oo2p3k0TPeZ0E=; b=Jc1CphfRSWxz5wYayoP/U/xvKpqPawoaLae68Rzm8LdPFQHqY/WogHRGmsMdIpLhWD HpcZ7um/TSqx+A7OiaeKW8fYGtveVT8xkaOufkpi1LDPEKOBNHcVr0UKLWitLgKQcJmb iSxcv3LFNGJlvrVjyPT+jW90Ay8unqyBT3e3c= MIME-Version: 1.0 Date: Thu, 2 Feb 2012 04:12:53 +0100 Message-ID: Subject: [digester] ofTypeSpecifiedByAttribute doesnt work From: =?ISO-8859-2?Q?Adam_Kud=B3a?= To: dev@commons.apache.org Content-Type: text/plain; charset=ISO-8859-2 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org Hi, tonight I have spent 5 hours working over one bug in my app. Unfortunately I digged to some place of code where I think I found a bug in Digester It is in: org.apache.commons.digester3.ObjectCreateRule I think this part of code: @Override public void begin( String namespace, String name, Attributes attributes= ) throws Exception { Class clazz =3D this.clazz; if ( clazz =3D=3D null ) { // Identify the name of the class to instantiate String realClassName =3D className; if ( attributeName !=3D null ) { String value =3D attributes.getValue( attributeName ); if ( value !=3D null ) { realClassName =3D value; } } if ( getDigester().getLogger().isDebugEnabled() ) { getDigester().getLogger().debug( format( "[ObjectCreateRule]{%s} New '%s'", getDigester().getMatch(), realClassName ) ); } // Instantiate the new object and push it on the context stack clazz =3D getDigester().getClassLoader().loadClass( realClassNa= me ); } doesn't work in that way I want. When I have specified this rule: forPattern("neuralNetwork/layers/layer/neuron/activationFunction").createOb= ject() .ofType(DefaultActivationFunction.class).ofTypeSpecifiedByAttrib= ute("typeName").then().setProperties().then().setNext("setActivationFunctio= n"); and having this XML: and of course LinearActivationFunction is a subclass of DefaultActivationFunction... When is used method ofType(...) - it is set this.clazz which automaticaly distable acces in the 'if' part of code body. This code works but allways returns DefaultActivationFunction. Inside ObjectCreateRule instance attributeName is not null so it looks like if statement is some kind of wrong. Am I doing something wrong? Or is it a bug? Thanks --=20 Adam Kud=B3a adamkudla@gmail.com --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org For additional commands, e-mail: dev-help@commons.apache.org