You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by bu...@apache.org on 2002/11/01 13:26:24 UTC

DO NOT REPLY [Bug 14160] New: - cannot compare Timestamp.getTime() to 0

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14160>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14160

cannot compare Timestamp.getTime() to 0

           Summary: cannot compare Timestamp.getTime() to 0
           Product: Velocity
           Version: 1.3-rc1
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Build
        AssignedTo: velocity-dev@jakarta.apache.org
        ReportedBy: melehin_anton@mail.ru


I was trying to make a macro to show empty line when $dt (Timestamp) object is 
empty:

#macro ( dateshowempty $dt)
  #set ($mlsc = $dt.getTime())
  #if ($mlsc == 0) --.--.---- 
  #else ${dt} 
  #end
debug: $mlsc
#end

Argument is Timestamp object. Macro never prints empty line (--.--.----)
Condition doesn't work... 
However, debug line prints [debug: 0]

Perhaps, it happens because getTime() returns long? 
Velocity cannot compare Long to Integer and condition is wrong forever?

I changed line: #set ($mlsc = $dt.getTime()) to: #set ($mlsc = 0) -- everything OK --
 I saw my empty line (--.--.----)

Maybe I could set $mlsc to long type (something like 0L), but I don't know how to 
do it...

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>