This code block looks ok to me. We can't remove this because that would be
incompatible. If we remove this check and always return "" for bad methods
then
$validobject.nullMethod()
would echo "$validobject.nullMethod()" pre-update and empty string
post-update.
WILL
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, October 01, 2005 6:11 AM
Subject: svn commit: r292980 -
/jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTMethod.java
Author: henning
Date: Sat Oct 1 06:11:39 2005
New Revision: 292980
URL: http://svn.apache.org/viewcvs?rev=292980&view=rev
Log:
Remove String(String) C'tor.
Can anyone tell me whether this whole code segment is actually
correct? Because a method returning 'null' and not having a void
return type might cause this code to return 'null' to the
caller. According to the comment on top of this block, this might
actually be a bad idea. Maybe we can just remove the whole
method.getReturnType() check and return unconditionally "" when the
result is null?
Modified:
jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTMethod.java
Modified:
jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTMethod.java
URL:
http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTMethod.java?rev=292980&r1=292979&r2=292980&view=diff
==============================================================================
---
jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTMethod.java
(original)
+++
jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTMethod.java
Sat Oct 1 06:11:39 2005
@@ -209,7 +209,9 @@
if (obj == null)
{
if( method.getReturnType() == Void.TYPE)
- return new String("");
+ {
+ return "";
+ }
}
return obj;
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]