syntax error on token "(", expression expected after this token

One Star

syntax error on token "(", expression expected after this token

Hello ,

Im using talend open studio (4.1.1.r50363)

I need to send a mail with attachment only if my condition meets with system time (ie:scheduling inside talend without using 3rd party tool) .
so i used "tjavarow" stage and wrote a java code as follows :
------------------------------
String Time=TalendDate.formatDate("HH:mm",TalendDate.getCurrentDate());
String t="10:30";
if(Time==t)
{
globalMap.put("isSend", true);
}
else
{
globalMap.put("isSend",false);
}
-------------------------------
This code works fine in Eclipse but it shows some error in talend as follows :
-------------------------------
syntax error on token "(", expression expected after this token
-------------------------------
Is there any other way to schedule the job inside talend or pls suggest me to overcome this issue .
Thanks In Advance ,
Nilesh R
One Star

Re: syntax error on token "(", expression expected after this token

can anyone help me out for this issue asap?
One Star

Re: syntax error on token "(", expression expected after this token

I'd stay away from using Time as a variable name. It's a class in java.sql. Also, use equals() for string comparison.
String curr_t=TalendDate.formatDate("HH:mm",TalendDate.getCurrentDate());
String t="10:30";
if( curr_t != null && curr_t.equals(t) )
{
globalMap.put("isSend", true);
}
else
{
globalMap.put("isSend",false);
}