From issues-return-14187-apmail-struts-issues-archive=struts.apache.org@struts.apache.org Wed Nov 04 08:19:45 2009 Return-Path: Delivered-To: apmail-struts-issues-archive@minotaur.apache.org Received: (qmail 50315 invoked from network); 4 Nov 2009 08:19:45 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 4 Nov 2009 08:19:45 -0000 Received: (qmail 8781 invoked by uid 500); 4 Nov 2009 08:19:45 -0000 Delivered-To: apmail-struts-issues-archive@struts.apache.org Received: (qmail 8728 invoked by uid 500); 4 Nov 2009 08:19:44 -0000 Mailing-List: contact issues-help@struts.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@struts.apache.org Delivered-To: mailing list issues@struts.apache.org Received: (qmail 8720 invoked by uid 99); 4 Nov 2009 08:19:44 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Nov 2009 08:19:44 +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; Wed, 04 Nov 2009 08:19:34 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 97233234C04C for ; Wed, 4 Nov 2009 00:19:13 -0800 (PST) Message-ID: <815692531.1257322753601.JavaMail.jira@brutus> Date: Wed, 4 Nov 2009 08:19:13 +0000 (UTC) From: =?UTF-8?Q?Andreas_Kr=C3=BCger_=28JIRA=29?= To: issues@struts.apache.org Subject: [jira] Commented: (WW-3306) Null value accepted from action property, but not model property when throwExceptionOnFailure=true In-Reply-To: <671264498.1256821130168.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 2265bf7ad70cb93affdfde3e15287371 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/struts/browse/WW-3306?page=3Dcom.atlassian.= jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D47030= #action_47030 ]=20 Andreas Kr=C3=BCger commented on WW-3306: ------------------------------------ Thank you. This is already better. But, unfortunately our real world application still wasn't happy. To reproduce the problem the real world application exposes, I enhanced the model class and the jsp as follows. When this bug is solved, the enhanced JSP as below should not throw an erro= r, even if struts.el.throwExceptionOnFailure=3Dtrue . =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D public class StrutsBugModel { final private StrutsBugModel deep; public StrutsBugModel() { this(true); } private StrutsBugModel(boolean needDeep) { if(needDeep) deep =3D new StrutsBugModel(false); else deep =3D null; =20 } public String getModelprop() {return null;} public void setModelprop(String foo) {throw new UnsupportedOperationExc= eption();} public StrutsBugModel getDeep() {return deep;} public void setDeep(StrutsBugModel deep) {throw new UnsupportedOperatio= nException();} =20 @Override public String toString() { if(deep =3D=3D null) return "shallow model"; else return "deep model"; } } =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D <%@ page language=3D"java" contentType=3D"text/html; charset=3DUTF-8" pageE= ncoding=3D"UTF-8"%> <%@ taglib prefix=3D"s" uri=3D"/struts-tags"%> Weird struts behaviour

Weird struts behaviour

See https://issues.apache.org/struts/browse/WW-3306 .

All of these work

Property modelprop from the model is null, as <= ;s:if> is happy to tell us.

Property modelprop from the model is not null. (Well, i= t is, so this text never shows.)

Property actionprop from the action is null, as &= lt;s:if> is happy to tell us.

Property actionprop from the action is not null. (Well,= it is, so this text never shows.)

Applying a null into the text, from an action property, here it comes: &= ldquo;” - this works and causes no problems, even though we have set struts.el.throwExceptionOnFailure=3Dtrue in struts.prope= rties .

This now works - it did not before

Applying a null into the text from a model property, here it comes: &ldq= uo;”.

This does not work: Nested property with null value

Accessing a nested property (via toString()) isn't in itsel= f a problem: “

Accessing a nested null property: “

Click here to expo= se the bug.

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D For the record: We want our test environment to deviate from the production environment as little as possible, and we will not (be allowed to) use a non-released version in our production environment. So this is what I did for the test: svn co -r2059 http://svn.opensymphony.com/svn/xwork/trunk xwork svn merge -r2063:2064 http://svn.opensymphony.com/svn/xwork/trunk xwork find xwork -name pom.xml | xargs grep -l 2.1.6 /dev/null | xargs perl -i.oripom -wpe 's/2\.1\.6/2.1.6.1/' cd xwork Then, DefaultValidatorFileParserTest#testParserWithBadXML2() gave line numb= er -1, not the expected line number 8. I worked around this problem (without fixin= g). Secondly, org.apache.maven.shared:maven-repository-builder:jar:1.0-alpha-1 could not be found. I went to xwork/assembly/pom.xml and changed the versio= n of maven-assembly-plugin to 2.2-beta-4 (twice). After that, mvn -U clean install mvn -U source:jar > Null value accepted from action property, but not model property when thr= owExceptionOnFailure=3Dtrue > -------------------------------------------------------------------------= ------------------------- > > Key: WW-3306 > URL: https://issues.apache.org/struts/browse/WW-3306 > Project: Struts 2 > Issue Type: Bug > Components: Value Stack > Affects Versions: 2.2.0 > Reporter: Andreas Kr=C3=BCger > Fix For: 2.2.0 > > > In this project, we experiment with setting struts.el.throwExceptionOnFai= lure=3Dtrue to catch errors. > We use in our JSP. > Occasionally, the property thus referenced is null. We want struts to ins= ert an empty string in that case. > This it duely does, when either struts.el.throwExceptionOnFailure=3Dfalse= or when the property is from an action object. > However, if the property is from a model object and struts.el.throwExcept= ionOnFailure=3Dtrue, this bombs out. --=20 This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.