|
View:
New views
20 Messages
—
Rating Filter:
Alert me
|
| < Prev | 1 - 2 | Next > |
|
|
[jira] Created: (WW-3306) Null value accepted from action property, but not model property when throwExceptionOnFailure=trueNull value accepted from action property, but not model property when throwExceptionOnFailure=true
-------------------------------------------------------------------------------------------------- Key: WW-3306 URL: https://issues.apache.org/struts/browse/WW-3306 Project: Struts 2 Issue Type: Bug Components: Value Stack Affects Versions: 2.1.8 Reporter: Andreas Krüger In this project, we experiment with setting struts.el.throwExceptionOnFailure=true to catch errors. We use <s:property value="myprop" /> in our JSP. Occasionally, the property thus referenced is null. We want struts to insert an empty string in that case. This it duely does, when either struts.el.throwExceptionOnFailure=false or when the property is from an action object. However, if the property is from a model object and struts.el.throwExceptionOnFailure=true, this bombs out. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
[jira] Commented: (WW-3306) Null value accepted from action property, but not model property when throwExceptionOnFailure=true[ https://issues.apache.org/struts/browse/WW-3306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46990#action_46990 ] Andreas Krüger commented on WW-3306: ------------------------------------ For details: I'm using this Action class: public class StrutsBugAction implements ModelDriven<StrutsBugModel>, Action { private final StrutsBugModel model = new StrutsBugModel(); private boolean bomb = false; public StrutsBugAction() {} public StrutsBugModel getModel() { return model; } public String getActionprop() { return null; } public void setActionprop(String actionProp) { } public String execute() { return SUCCESS; } public boolean getBomb() { return bomb; } public void setBomb(boolean bomb) { this.bomb = bomb; } } I'm using this Model class: public class StrutsBugModel { public String getModelprop() {return null;} public void setModelprop(String foo) {} } I'm using this JSP as a view: <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ taglib prefix="s" uri="/struts-tags"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Weird struts behaviour</title> </head> <body> <h1>Weird struts behaviour</h1> <p style="font-size:120%">See <a href="https://issues.apache.org/struts/browse/WW-3306">https://issues.apache.org/struts/browse/WW-3306</a> .</p> <h2>All of these work</h2> <s:if test="modelprop == null"> <p>Property <code>modelprop</code> from the model is null, as <code><s:if></code> is happy to tell us.</p> </s:if> <s:else> <p>Property <code>modelprop</code> from the model is not null. (Well, it is, so this text never shows.)</p> </s:else> <s:if test="actionprop == null"> <p>Property <code>actionprop</code> from the action is null, as <code><s:if></code> is happy to tell us.</p> </s:if> <s:else> <p>Property <code>actionprop</code> from the action is not null. (Well, it is, so this text never shows.)</p> </s:else> <p>Applying a null into the text, from an action property, here it comes: “<s:property value="actionprop" />” - this works and causes no problems, even though we have set <code>struts.el.throwExceptionOnFailure=true</code> in <code>struts.properties</code> .</p> <h2>This does not work</h2> <p>Applying a null into the text, from a <em>model</em> property, using exactly the same code as above, does not work whenever we have set <code>struts.el.throwExceptionOnFailure=true</code> in <code>struts.properties</code>. The only difference is that this is a property from a model, not one from an action.</p> <s:if test="bomb"> <p>“<s:property value="modelprop" />”</p> </s:if> <s:else> <p><s:a ><s:param name="bomb" value="true"/>Click here</s:a> to expose the bug.</p> </s:else> </body> </html> > Null value accepted from action property, but not model property when throwExceptionOnFailure=true > -------------------------------------------------------------------------------------------------- > > Key: WW-3306 > URL: https://issues.apache.org/struts/browse/WW-3306 > Project: Struts 2 > Issue Type: Bug > Components: Value Stack > Affects Versions: 2.1.8 > Reporter: Andreas Krüger > > In this project, we experiment with setting struts.el.throwExceptionOnFailure=true to catch errors. > We use <s:property value="myprop" /> in our JSP. > Occasionally, the property thus referenced is null. We want struts to insert an empty string in that case. > This it duely does, when either struts.el.throwExceptionOnFailure=false or when the property is from an action object. > However, if the property is from a model object and struts.el.throwExceptionOnFailure=true, this bombs out. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
[jira] Issue Comment Edited: (WW-3306) Null value accepted from action property, but not model property when throwExceptionOnFailure=true[ https://issues.apache.org/struts/browse/WW-3306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46990#action_46990 ] Andreas Krüger edited comment on WW-3306 at 10/29/09 6:06 AM: -------------------------------------------------------------- For details: I'm using this Action class: public class StrutsBugAction implements ModelDriven<StrutsBugModel>, Action { private final StrutsBugModel model = new StrutsBugModel(); private boolean bomb = false; public StrutsBugAction() {} public StrutsBugModel getModel() { return model; } public String getActionprop() { return null; } public void setActionprop(String actionProp) { } public String execute() { return SUCCESS; } public boolean getBomb() { return bomb; } public void setBomb(boolean bomb) { this.bomb = bomb; } } I'm using this Model class: public class StrutsBugModel { public String getModelprop() {return null;} public void setModelprop(String foo) {} } I'm using this JSP as a view: <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ taglib prefix="s" uri="/struts-tags"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Weird struts behaviour</title> </head> <body> <h1>Weird struts behaviour</h1> <p style="font-size:120%">See <a href="https://issues.apache.org/struts/browse/WW-3306">https://issues.apache.org/struts/browse/WW-3306 </a> .</p> <h2>All of these work</h2> <s:if test="modelprop == null"> <p>Property <code>modelprop</code> from the model is null, as <code><s:if></code> is happy to tell us.</p> </s:if> <s:else> <p>Property <code>modelprop</code> from the model is not null. (Well, it is, so this text never shows.)</p> </s:else> <s:if test="actionprop == null"> <p>Property <code>actionprop</code> from the action is null, as <code><s:if></code> is happy to tell us.</p> </s:if> <s:else> <p>Property <code>actionprop</code> from the action is not null. (Well, it is, so this text never shows.)</p> </s:else> <p>Applying a null into the text, from an action property, here it comes: “<s:property value="actionprop" />” - this works and causes no problems, even though we have set <code>struts.el.throwExceptionOnFailure=true</code> in <code>struts.properties</code> .</p> <h2>This does not work</h2> <p>Applying a null into the text, from a <em>model</em> property, using exactly the same code as above, does not work whenever we have set <code>struts.el.throwExceptionOnFailure=true</code> in <code>struts.properties</code>. The only difference is that this is a property from a model, not one from an action.</p> <s:if test="bomb"> <p>“<s:property value="modelprop" />”</p> </s:if> <s:else> <p><s:a ><s:param name="bomb" value="true"/>Click here</s:a> to expose the bug.</p> </s:else> </body> </html> was (Author: andreas.krueger): For details: I'm using this Action class: public class StrutsBugAction implements ModelDriven<StrutsBugModel>, Action { private final StrutsBugModel model = new StrutsBugModel(); private boolean bomb = false; public StrutsBugAction() {} public StrutsBugModel getModel() { return model; } public String getActionprop() { return null; } public void setActionprop(String actionProp) { } public String execute() { return SUCCESS; } public boolean getBomb() { return bomb; } public void setBomb(boolean bomb) { this.bomb = bomb; } } I'm using this Model class: public class StrutsBugModel { public String getModelprop() {return null;} public void setModelprop(String foo) {} } I'm using this JSP as a view: <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ taglib prefix="s" uri="/struts-tags"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Weird struts behaviour</title> </head> <body> <h1>Weird struts behaviour</h1> <p style="font-size:120%">See <a href="https://issues.apache.org/struts/browse/WW-3306">https://issues.apache.org/struts/browse/WW-3306</a> .</p> <h2>All of these work</h2> <s:if test="modelprop == null"> <p>Property <code>modelprop</code> from the model is null, as <code><s:if></code> is happy to tell us.</p> </s:if> <s:else> <p>Property <code>modelprop</code> from the model is not null. (Well, it is, so this text never shows.)</p> </s:else> <s:if test="actionprop == null"> <p>Property <code>actionprop</code> from the action is null, as <code><s:if></code> is happy to tell us.</p> </s:if> <s:else> <p>Property <code>actionprop</code> from the action is not null. (Well, it is, so this text never shows.)</p> </s:else> <p>Applying a null into the text, from an action property, here it comes: “<s:property value="actionprop" />” - this works and causes no problems, even though we have set <code>struts.el.throwExceptionOnFailure=true</code> in <code>struts.properties</code> .</p> <h2>This does not work</h2> <p>Applying a null into the text, from a <em>model</em> property, using exactly the same code as above, does not work whenever we have set <code>struts.el.throwExceptionOnFailure=true</code> in <code>struts.properties</code>. The only difference is that this is a property from a model, not one from an action.</p> <s:if test="bomb"> <p>“<s:property value="modelprop" />”</p> </s:if> <s:else> <p><s:a ><s:param name="bomb" value="true"/>Click here</s:a> to expose the bug.</p> </s:else> </body> </html> > Null value accepted from action property, but not model property when throwExceptionOnFailure=true > -------------------------------------------------------------------------------------------------- > > Key: WW-3306 > URL: https://issues.apache.org/struts/browse/WW-3306 > Project: Struts 2 > Issue Type: Bug > Components: Value Stack > Affects Versions: 2.1.8 > Reporter: Andreas Krüger > > In this project, we experiment with setting struts.el.throwExceptionOnFailure=true to catch errors. > We use <s:property value="myprop" /> in our JSP. > Occasionally, the property thus referenced is null. We want struts to insert an empty string in that case. > This it duely does, when either struts.el.throwExceptionOnFailure=false or when the property is from an action object. > However, if the property is from a model object and struts.el.throwExceptionOnFailure=true, this bombs out. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
[jira] Commented: (WW-3306) Null value accepted from action property, but not model property when throwExceptionOnFailure=true[ https://issues.apache.org/struts/browse/WW-3306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46991#action_46991 ] Musachy Barroso commented on WW-3306: ------------------------------------- what is happening for the model is the expected behavior, it should fail when a property is not found, or there is an exception while evaluating the expression. We have to figure out while it doesn't fail for the action > Null value accepted from action property, but not model property when throwExceptionOnFailure=true > -------------------------------------------------------------------------------------------------- > > Key: WW-3306 > URL: https://issues.apache.org/struts/browse/WW-3306 > Project: Struts 2 > Issue Type: Bug > Components: Value Stack > Affects Versions: 2.1.8 > Reporter: Andreas Krüger > > In this project, we experiment with setting struts.el.throwExceptionOnFailure=true to catch errors. > We use <s:property value="myprop" /> in our JSP. > Occasionally, the property thus referenced is null. We want struts to insert an empty string in that case. > This it duely does, when either struts.el.throwExceptionOnFailure=false or when the property is from an action object. > However, if the property is from a model object and struts.el.throwExceptionOnFailure=true, this bombs out. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
[jira] Updated: (WW-3306) Null value accepted from action property, but not model property when throwExceptionOnFailure=true[ https://issues.apache.org/struts/browse/WW-3306?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Musachy Barroso updated WW-3306: -------------------------------- Affects Version/s: (was: 2.1.8) 2.2.0 > Null value accepted from action property, but not model property when throwExceptionOnFailure=true > -------------------------------------------------------------------------------------------------- > > 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üger > > In this project, we experiment with setting struts.el.throwExceptionOnFailure=true to catch errors. > We use <s:property value="myprop" /> in our JSP. > Occasionally, the property thus referenced is null. We want struts to insert an empty string in that case. > This it duely does, when either struts.el.throwExceptionOnFailure=false or when the property is from an action object. > However, if the property is from a model object and struts.el.throwExceptionOnFailure=true, this bombs out. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
[jira] Commented: (WW-3306) Null value accepted from action property, but not model property when throwExceptionOnFailure=true[ https://issues.apache.org/struts/browse/WW-3306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46993#action_46993 ] Andreas Krüger commented on WW-3306: ------------------------------------ Excuse me, but what is happening for the ACTION is what we need. What happens for the MODEL is the BUG, as far as we are concerned. The property is found allright. It's just that its value happens to be null. So there is no reason to complain about the property's not being found. There's nothing wrong with null. (If there were something wrong, the property's get-er would throw some Exception.) How do we explain to Struts that null is fine and should be treated same as ""? The only way we have found to explain this to struts is, saying "struts.el.throwExceptionOnFailure=false" . We are very unhappy about having to say that. > Null value accepted from action property, but not model property when throwExceptionOnFailure=true > -------------------------------------------------------------------------------------------------- > > 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üger > > In this project, we experiment with setting struts.el.throwExceptionOnFailure=true to catch errors. > We use <s:property value="myprop" /> in our JSP. > Occasionally, the property thus referenced is null. We want struts to insert an empty string in that case. > This it duely does, when either struts.el.throwExceptionOnFailure=false or when the property is from an action object. > However, if the property is from a model object and struts.el.throwExceptionOnFailure=true, this bombs out. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
[jira] Issue Comment Edited: (WW-3306) Null value accepted from action property, but not model property when throwExceptionOnFailure=true[ https://issues.apache.org/struts/browse/WW-3306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46993#action_46993 ] Andreas Krüger edited comment on WW-3306 at 10/30/09 1:21 AM: -------------------------------------------------------------- Excuse me, but what is happening for the ACTION is what we need. What happens for the MODEL is the BUG, as far as we are concerned. The property is found allright. It's just that its value happens to be null. So there is no reason to complain about the property's not being found. There's nothing wrong with null. This is no longer the 80s. This is Java, this in no longer C. In C, returning something weird meant "error". In 2009, in Java, if our property's get-er wants to communicate an error, it throws an exception. We have found exceptions to provide a much superior error handling interface compared with that old "weird return value to communicate errors" stance that we used back in the old C day. How do we explain to Struts that, at least in our project's opinion how to program in Java, null is just fine and should be treated same as ""? The only way we have found to explain this to struts is, saying "struts.el.throwExceptionOnFailure=false" . We are very unhappy about having to say that. was (Author: andreas.krueger): Excuse me, but what is happening for the ACTION is what we need. What happens for the MODEL is the BUG, as far as we are concerned. The property is found allright. It's just that its value happens to be null. So there is no reason to complain about the property's not being found. There's nothing wrong with null. (If there were something wrong, the property's get-er would throw some Exception.) How do we explain to Struts that null is fine and should be treated same as ""? The only way we have found to explain this to struts is, saying "struts.el.throwExceptionOnFailure=false" . We are very unhappy about having to say that. > Null value accepted from action property, but not model property when throwExceptionOnFailure=true > -------------------------------------------------------------------------------------------------- > > 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üger > > In this project, we experiment with setting struts.el.throwExceptionOnFailure=true to catch errors. > We use <s:property value="myprop" /> in our JSP. > Occasionally, the property thus referenced is null. We want struts to insert an empty string in that case. > This it duely does, when either struts.el.throwExceptionOnFailure=false or when the property is from an action object. > However, if the property is from a model object and struts.el.throwExceptionOnFailure=true, this bombs out. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
[jira] Issue Comment Edited: (WW-3306) Null value accepted from action property, but not model property when throwExceptionOnFailure=true[ https://issues.apache.org/struts/browse/WW-3306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46993#action_46993 ] Andreas Krüger edited comment on WW-3306 at 10/30/09 1:23 AM: -------------------------------------------------------------- Excuse me, but what is happening for the ACTION is what we need. What happens for the MODEL is the BUG, as far as we are concerned. The property is found allright. It's just that its value happens to be null. So there is no reason to complain about the property's not being found. There's nothing wrong with null. This is no longer the 80s. This is Java, this in no longer C. In C, returning something weird meant "error". In 2009, in Java, if our property's get-er wants to communicate an error, it throws an exception. We have found exceptions to provide a much superior error handling interface compared with that old "weird return value to communicate errors" stance that we used back in the old C days. How do we explain to Struts that, at least in our project's opinion how to program in Java, null is just fine and should be treated same as ""? The only way we have found to explain this to struts is, saying "struts.el.throwExceptionOnFailure=false" . We are very unhappy about having to say that. was (Author: andreas.krueger): Excuse me, but what is happening for the ACTION is what we need. What happens for the MODEL is the BUG, as far as we are concerned. The property is found allright. It's just that its value happens to be null. So there is no reason to complain about the property's not being found. There's nothing wrong with null. This is no longer the 80s. This is Java, this in no longer C. In C, returning something weird meant "error". In 2009, in Java, if our property's get-er wants to communicate an error, it throws an exception. We have found exceptions to provide a much superior error handling interface compared with that old "weird return value to communicate errors" stance that we used back in the old C day. How do we explain to Struts that, at least in our project's opinion how to program in Java, null is just fine and should be treated same as ""? The only way we have found to explain this to struts is, saying "struts.el.throwExceptionOnFailure=false" . We are very unhappy about having to say that. > Null value accepted from action property, but not model property when throwExceptionOnFailure=true > -------------------------------------------------------------------------------------------------- > > 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üger > > In this project, we experiment with setting struts.el.throwExceptionOnFailure=true to catch errors. > We use <s:property value="myprop" /> in our JSP. > Occasionally, the property thus referenced is null. We want struts to insert an empty string in that case. > This it duely does, when either struts.el.throwExceptionOnFailure=false or when the property is from an action object. > However, if the property is from a model object and struts.el.throwExceptionOnFailure=true, this bombs out. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
[jira] Issue Comment Edited: (WW-3306) Null value accepted from action property, but not model property when throwExceptionOnFailure=true[ https://issues.apache.org/struts/browse/WW-3306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46993#action_46993 ] Andreas Krüger edited comment on WW-3306 at 10/30/09 1:25 AM: -------------------------------------------------------------- Excuse me, but what is happening for the ACTION is what we need. What happens for the MODEL is the BUG, as far as we are concerned. The property is found allright. It's just that its value happens to be null. So there is no reason to complain about the property's not being found. There's nothing wrong with null. This is no longer the 80s. This is Java, this in no longer C. In C, returning something weird meant "error". In 2009, in Java, if our property's get-er wants to communicate an error, it throws an exception. We have found exceptions to provide a much superior error handling interface compared with that old "weird return value to communicate errors" stance that we used back in the old C days. How do we explain to Struts that, at least in our project's opinion how to program in Java, null is just fine and should be treated same as ""? The only way we have found to explain this to Struts is, saying "struts.el.throwExceptionOnFailure=false" . We are very unhappy about having to say that. was (Author: andreas.krueger): Excuse me, but what is happening for the ACTION is what we need. What happens for the MODEL is the BUG, as far as we are concerned. The property is found allright. It's just that its value happens to be null. So there is no reason to complain about the property's not being found. There's nothing wrong with null. This is no longer the 80s. This is Java, this in no longer C. In C, returning something weird meant "error". In 2009, in Java, if our property's get-er wants to communicate an error, it throws an exception. We have found exceptions to provide a much superior error handling interface compared with that old "weird return value to communicate errors" stance that we used back in the old C days. How do we explain to Struts that, at least in our project's opinion how to program in Java, null is just fine and should be treated same as ""? The only way we have found to explain this to struts is, saying "struts.el.throwExceptionOnFailure=false" . We are very unhappy about having to say that. > Null value accepted from action property, but not model property when throwExceptionOnFailure=true > -------------------------------------------------------------------------------------------------- > > 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üger > > In this project, we experiment with setting struts.el.throwExceptionOnFailure=true to catch errors. > We use <s:property value="myprop" /> in our JSP. > Occasionally, the property thus referenced is null. We want struts to insert an empty string in that case. > This it duely does, when either struts.el.throwExceptionOnFailure=false or when the property is from an action object. > However, if the property is from a model object and struts.el.throwExceptionOnFailure=true, this bombs out. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
[jira] Issue Comment Edited: (WW-3306) Null value accepted from action property, but not model property when throwExceptionOnFailure=true[ https://issues.apache.org/struts/browse/WW-3306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46993#action_46993 ] Andreas Krüger edited comment on WW-3306 at 10/30/09 1:25 AM: -------------------------------------------------------------- Excuse me, but what is happening for the ACTION is what we need. What happens for the MODEL is the BUG, as far as we are concerned. The property is found allright. It's just that its value happens to be null. So there is no reason to complain about the property's not being found. There's nothing wrong with null. This is no longer the 80s. This is Java, this is no longer C. In C, returning something weird meant "error". In 2009, in Java, if our property's get-er wants to communicate an error, it throws an exception. We have found exceptions to provide a much superior error handling interface compared with that old "weird return value to communicate errors" stance that we used back in the old C days. How do we explain to Struts that, at least in our project's opinion how to program in Java, null is just fine and should be treated same as ""? The only way we have found to explain this to Struts is, saying "struts.el.throwExceptionOnFailure=false" . We are very unhappy about having to say that. was (Author: andreas.krueger): Excuse me, but what is happening for the ACTION is what we need. What happens for the MODEL is the BUG, as far as we are concerned. The property is found allright. It's just that its value happens to be null. So there is no reason to complain about the property's not being found. There's nothing wrong with null. This is no longer the 80s. This is Java, this in no longer C. In C, returning something weird meant "error". In 2009, in Java, if our property's get-er wants to communicate an error, it throws an exception. We have found exceptions to provide a much superior error handling interface compared with that old "weird return value to communicate errors" stance that we used back in the old C days. How do we explain to Struts that, at least in our project's opinion how to program in Java, null is just fine and should be treated same as ""? The only way we have found to explain this to Struts is, saying "struts.el.throwExceptionOnFailure=false" . We are very unhappy about having to say that. > Null value accepted from action property, but not model property when throwExceptionOnFailure=true > -------------------------------------------------------------------------------------------------- > > 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üger > > In this project, we experiment with setting struts.el.throwExceptionOnFailure=true to catch errors. > We use <s:property value="myprop" /> in our JSP. > Occasionally, the property thus referenced is null. We want struts to insert an empty string in that case. > This it duely does, when either struts.el.throwExceptionOnFailure=false or when the property is from an action object. > However, if the property is from a model object and struts.el.throwExceptionOnFailure=true, this bombs out. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
[jira] Issue Comment Edited: (WW-3306) Null value accepted from action property, but not model property when throwExceptionOnFailure=true[ https://issues.apache.org/struts/browse/WW-3306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46993#action_46993 ] Andreas Krüger edited comment on WW-3306 at 10/30/09 1:27 AM: -------------------------------------------------------------- Excuse me, but what is happening for the ACTION is what we need. What happens for the MODEL is the BUG, as far as we are concerned. The property is found allright. It's just that its value happens to be null. So there is no reason to complain about the property's not being found. There's nothing wrong with null. This is no longer the 80s. This is Java, this is no longer C. In C, returning something weird meant "error". In 2009, in Java, if our property's get-er wants to communicate an error, it throws an exception. We have found exceptions to provide a much superior error handling interface compared with that old "weird return value to communicate errors" stance that we used back in the old C days. How do we explain to Struts that, at least in our project's opinion how to program in Java, null is just fine (and should be treated same as "" in String context)? The only way we have found to explain this to Struts is, saying "struts.el.throwExceptionOnFailure=false" . We are very unhappy about having to say that. was (Author: andreas.krueger): Excuse me, but what is happening for the ACTION is what we need. What happens for the MODEL is the BUG, as far as we are concerned. The property is found allright. It's just that its value happens to be null. So there is no reason to complain about the property's not being found. There's nothing wrong with null. This is no longer the 80s. This is Java, this is no longer C. In C, returning something weird meant "error". In 2009, in Java, if our property's get-er wants to communicate an error, it throws an exception. We have found exceptions to provide a much superior error handling interface compared with that old "weird return value to communicate errors" stance that we used back in the old C days. How do we explain to Struts that, at least in our project's opinion how to program in Java, null is just fine and should be treated same as ""? The only way we have found to explain this to Struts is, saying "struts.el.throwExceptionOnFailure=false" . We are very unhappy about having to say that. > Null value accepted from action property, but not model property when throwExceptionOnFailure=true > -------------------------------------------------------------------------------------------------- > > 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üger > > In this project, we experiment with setting struts.el.throwExceptionOnFailure=true to catch errors. > We use <s:property value="myprop" /> in our JSP. > Occasionally, the property thus referenced is null. We want struts to insert an empty string in that case. > This it duely does, when either struts.el.throwExceptionOnFailure=false or when the property is from an action object. > However, if the property is from a model object and struts.el.throwExceptionOnFailure=true, this bombs out. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
[jira] Commented: (WW-3306) Null value accepted from action property, but not model property when throwExceptionOnFailure=true[ https://issues.apache.org/struts/browse/WW-3306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46994#action_46994 ] Musachy Barroso commented on WW-3306: ------------------------------------- O_o. By default all EL errors are swallowed, you don't need to set that flag at all. If a property is null, or there is an exception evaluating an expression nothing happens and nothing get written to the output. Many users have asked a way to make struts throw an exception when an EL expression uses an invalid property or when an exception is throw, and that's what struts.el.throwExceptionOnFailure=true does. Thanks for the best practices tutorial/tutorial, but I have a strong feeling that having created this setting myself, I might know what I am talking about. > Null value accepted from action property, but not model property when throwExceptionOnFailure=true > -------------------------------------------------------------------------------------------------- > > 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üger > > In this project, we experiment with setting struts.el.throwExceptionOnFailure=true to catch errors. > We use <s:property value="myprop" /> in our JSP. > Occasionally, the property thus referenced is null. We want struts to insert an empty string in that case. > This it duely does, when either struts.el.throwExceptionOnFailure=false or when the property is from an action object. > However, if the property is from a model object and struts.el.throwExceptionOnFailure=true, this bombs out. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
[jira] Commented: (WW-3306) Null value accepted from action property, but not model property when throwExceptionOnFailure=true[ https://issues.apache.org/struts/browse/WW-3306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=47014#action_47014 ] Andreas Krüger commented on WW-3306: ------------------------------------ You have written this stuff? Wonderful! Please kindly advice, if you would: In our project, we want both of these two simultaniously: * If a property is null, nothing happens and nothing get written to the output. * Make Struts throw an exception when either an EL expression uses an invalid property (that is, there is no getter matching the property, or the getter is not accessible) or else when an exception is throw out of the getter. Is there a way to have Struts EL to do BOTH of these things, and, of course, consistently for both action and model? > Null value accepted from action property, but not model property when throwExceptionOnFailure=true > -------------------------------------------------------------------------------------------------- > > 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üger > > In this project, we experiment with setting struts.el.throwExceptionOnFailure=true to catch errors. > We use <s:property value="myprop" /> in our JSP. > Occasionally, the property thus referenced is null. We want struts to insert an empty string in that case. > This it duely does, when either struts.el.throwExceptionOnFailure=false or when the property is from an action object. > However, if the property is from a model object and struts.el.throwExceptionOnFailure=true, this bombs out. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
[jira] Issue Comment Edited: (WW-3306) Null value accepted from action property, but not model property when throwExceptionOnFailure=true[ https://issues.apache.org/struts/browse/WW-3306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=47014#action_47014 ] Andreas Krüger edited comment on WW-3306 at 11/2/09 1:23 AM: ------------------------------------------------------------- You have written this stuff? Wonderful! Please kindly advice, if you would: In our project, we want both of these two simultaniously: * If a property is null, nothing happens and nothing get written to the output. * Make Struts throw an exception when either an EL expression uses an invalid property (that is, there is no getter matching the property, or the getter is not accessible) or else when an exception is throw (out of whatever gets called by the EL expression). Is there a way to have Struts EL to do BOTH of these things, and, of course, consistently for both action and model? was (Author: andreas.krueger): You have written this stuff? Wonderful! Please kindly advice, if you would: In our project, we want both of these two simultaniously: * If a property is null, nothing happens and nothing get written to the output. * Make Struts throw an exception when either an EL expression uses an invalid property (that is, there is no getter matching the property, or the getter is not accessible) or else when an exception is throw out of the getter. Is there a way to have Struts EL to do BOTH of these things, and, of course, consistently for both action and model? > Null value accepted from action property, but not model property when throwExceptionOnFailure=true > -------------------------------------------------------------------------------------------------- > > 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üger > > In this project, we experiment with setting struts.el.throwExceptionOnFailure=true to catch errors. > We use <s:property value="myprop" /> in our JSP. > Occasionally, the property thus referenced is null. We want struts to insert an empty string in that case. > This it duely does, when either struts.el.throwExceptionOnFailure=false or when the property is from an action object. > However, if the property is from a model object and struts.el.throwExceptionOnFailure=true, this bombs out. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
[jira] Commented: (WW-3306) Null value accepted from action property, but not model property when throwExceptionOnFailure=true[ https://issues.apache.org/struts/browse/WW-3306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=47016#action_47016 ] Musachy Barroso commented on WW-3306: ------------------------------------- By default(no need to set struts.el.throwExceptionOnFailure), struts will be silent about errors in expressions, if this is not the case, please provide more details and we will see if it is a bug. To make struts throw errors in expressions, and missing properties set struts.el.throwExceptionOnFailure=true. If the error is not consistent, provide details to reproduce. > Null value accepted from action property, but not model property when throwExceptionOnFailure=true > -------------------------------------------------------------------------------------------------- > > 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üger > > In this project, we experiment with setting struts.el.throwExceptionOnFailure=true to catch errors. > We use <s:property value="myprop" /> in our JSP. > Occasionally, the property thus referenced is null. We want struts to insert an empty string in that case. > This it duely does, when either struts.el.throwExceptionOnFailure=false or when the property is from an action object. > However, if the property is from a model object and struts.el.throwExceptionOnFailure=true, this bombs out. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
[jira] Commented: (WW-3306) Null value accepted from action property, but not model property when throwExceptionOnFailure=true[ https://issues.apache.org/struts/browse/WW-3306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=47018#action_47018 ] Andreas Krüger commented on WW-3306: ------------------------------------ > By default(no need to set struts.el.throwExceptionOnFailure), struts will be silent about errors in expressions, No problems as far as that is concerned. It's not what we want or need, but it functions as described. > To make struts throw errors in expressions, and missing properties set struts.el.throwExceptionOnFailure=true. This we do. And this does not work as described: It also throws exceptions not only on missing properties, but also on properties which exist, but return a null value. This bug seems to exist only when the property is a property of the model. All is well when the property is from an action object. The code as given above can be used to reproduce the bug. If you have any problem reproducing the bug, I'd be glad to help. > Null value accepted from action property, but not model property when throwExceptionOnFailure=true > -------------------------------------------------------------------------------------------------- > > 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üger > > In this project, we experiment with setting struts.el.throwExceptionOnFailure=true to catch errors. > We use <s:property value="myprop" /> in our JSP. > Occasionally, the property thus referenced is null. We want struts to insert an empty string in that case. > This it duely does, when either struts.el.throwExceptionOnFailure=false or when the property is from an action object. > However, if the property is from a model object and struts.el.throwExceptionOnFailure=true, this bombs out. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
[jira] Commented: (WW-3306) Null value accepted from action property, but not model property when throwExceptionOnFailure=true[ https://issues.apache.org/struts/browse/WW-3306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=47020#action_47020 ] Musachy Barroso commented on WW-3306: ------------------------------------- ok cool, so we are on the same page. I will take a look. > Null value accepted from action property, but not model property when throwExceptionOnFailure=true > -------------------------------------------------------------------------------------------------- > > 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üger > > In this project, we experiment with setting struts.el.throwExceptionOnFailure=true to catch errors. > We use <s:property value="myprop" /> in our JSP. > Occasionally, the property thus referenced is null. We want struts to insert an empty string in that case. > This it duely does, when either struts.el.throwExceptionOnFailure=false or when the property is from an action object. > However, if the property is from a model object and struts.el.throwExceptionOnFailure=true, this bombs out. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
[jira] Commented: (WW-3306) Null value accepted from action property, but not model property when throwExceptionOnFailure=true[ https://issues.apache.org/struts/browse/WW-3306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=47021#action_47021 ] Musachy Barroso commented on WW-3306: ------------------------------------- Confirmed. The problem is that the code that check for the missing property only checks the actions, if the action is ModelDriven, it doesn't check the model. I also found what it seems like another bug, this code in xwork: for (Object o : root) { if (o instanceof ActionSupport || o.getClass().getSimpleName().endsWith("Action")) { try { findAvailableProperties(o.getClass(), expr, availableProperties, null); } catch (IntrospectionException ise) { // ignore } } } it should check all objects in the stack, not only "o instanceof ActionSupport || o.getClass().getSimpleName().endsWith("Action")" > Null value accepted from action property, but not model property when throwExceptionOnFailure=true > -------------------------------------------------------------------------------------------------- > > 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üger > > In this project, we experiment with setting struts.el.throwExceptionOnFailure=true to catch errors. > We use <s:property value="myprop" /> in our JSP. > Occasionally, the property thus referenced is null. We want struts to insert an empty string in that case. > This it duely does, when either struts.el.throwExceptionOnFailure=false or when the property is from an action object. > However, if the property is from a model object and struts.el.throwExceptionOnFailure=true, this bombs out. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
[jira] Resolved: (WW-3306) Null value accepted from action property, but not model property when throwExceptionOnFailure=true[ https://issues.apache.org/struts/browse/WW-3306?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Musachy Barroso resolved WW-3306. --------------------------------- Resolution: Fixed Fix Version/s: 2.2.0 fixed in xwork trunk. test added as well. please confirm if it works for you. > Null value accepted from action property, but not model property when throwExceptionOnFailure=true > -------------------------------------------------------------------------------------------------- > > 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üger > Fix For: 2.2.0 > > > In this project, we experiment with setting struts.el.throwExceptionOnFailure=true to catch errors. > We use <s:property value="myprop" /> in our JSP. > Occasionally, the property thus referenced is null. We want struts to insert an empty string in that case. > This it duely does, when either struts.el.throwExceptionOnFailure=false or when the property is from an action object. > However, if the property is from a model object and struts.el.throwExceptionOnFailure=true, this bombs out. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
[jira] Commented: (WW-3306) Null value accepted from action property, but not model property when throwExceptionOnFailure=true[ https://issues.apache.org/struts/browse/WW-3306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=47030#action_47030 ] Andreas Krüger 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 error, even if struts.el.throwExceptionOnFailure=true . ======================================== public class StrutsBugModel { final private StrutsBugModel deep; public StrutsBugModel() { this(true); } private StrutsBugModel(boolean needDeep) { if(needDeep) deep = new StrutsBugModel(false); else deep = null; } public String getModelprop() {return null;} public void setModelprop(String foo) {throw new UnsupportedOperationException();} public StrutsBugModel getDeep() {return deep;} public void setDeep(StrutsBugModel deep) {throw new UnsupportedOperationException();} @Override public String toString() { if(deep == null) return "shallow model"; else return "deep model"; } } ======================================== <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ taglib prefix="s" uri="/struts-tags"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Weird struts behaviour</title> </head> <body> <h1>Weird struts behaviour</h1> <p style="font-size:120%">See <a href="https://issues.apache.org/struts/browse/WW-3306">https://issues.apache.org/struts/browse/WW-3306</a> .</p> <h2>All of these work</h2> <s:if test="modelprop == null"> <p>Property <code>modelprop</code> from the model is null, as <code><s:if></code> is happy to tell us.</p> </s:if> <s:else> <p>Property <code>modelprop</code> from the model is not null. (Well, it is, so this text never shows.)</p> </s:else> <s:if test="actionprop == null"> <p>Property <code>actionprop</code> from the action is null, as <code><s:if></code> is happy to tell us.</p> </s:if> <s:else> <p>Property <code>actionprop</code> from the action is not null. (Well, it is, so this text never shows.)</p> </s:else> <p>Applying a null into the text, from an action property, here it comes: “<s:property value="actionprop" />” - this works and causes no problems, even though we have set <code>struts.el.throwExceptionOnFailure=true</code> in <code>struts.properties</code> .</p> <h2>This now works - it did not before</h2> <p>Applying a null into the text from a model property, here it comes: “<s:property value="modelprop" />”.</p> <h2>This does not work: Nested property with null value</h2> <p>Accessing a nested property (via <code>toString()</code>) isn't in itself a problem: “<s:property value="deep.toString()" />”</p> <s:if test="bomb"> <p>Accessing a nested null property: “<s:property value="deep.modelProp" />”</p> </s:if> <s:else> <p><s:a ><s:param name="bomb" value="true"/>Click here</s:a> to expose the bug.</p> </s:else> </body> </html> ======================================== 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 number -1, not the expected line number 8. I worked around this problem (without fixing). 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 version 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 throwExceptionOnFailure=true > -------------------------------------------------------------------------------------------------- > > 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üger > Fix For: 2.2.0 > > > In this project, we experiment with setting struts.el.throwExceptionOnFailure=true to catch errors. > We use <s:property value="myprop" /> in our JSP. > Occasionally, the property thus referenced is null. We want struts to insert an empty string in that case. > This it duely does, when either struts.el.throwExceptionOnFailure=false or when the property is from an action object. > However, if the property is from a model object and struts.el.throwExceptionOnFailure=true, this bombs out. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
| < Prev | 1 - 2 | Next > |
| Free embeddable forum powered by Nabble | Forum Help |