I have some values i have stored in mysal table. basically, they are some strings that hold the value up or down.
I want to fetch the data in my table and compare if they are equal to up or down
This is the code
String up = "up";
String down = "down";
@SuppressWarnings("deprecation")
Query query = currentSession.createSQLQuery(
"select * from trades where trade_session_status=:trade_session_status AND trade_profit_worker_status=:trade_profit_worker_status");
query.setParameter("trade_session_status", "DONE");
query.setParameter("trade_profit_worker_status", "UNDONE");
@SuppressWarnings("rawtypes")
List < Object[] > result = query.list();
for (Object[] objects: result) {
Integer id = (Integer) objects[0];
String trade_prediction = (String) objects[10];
String trade_result = (String) objects[11];
if(trade_prediction.equals(up) && trade_result.equals(up)) {
}
The code works and i can test if the strings are equal but somewhere down the line, i get an error on this line
if(trade_prediction.equals(up) && trade_result.equals(up)) {
but the program still works.
I get this error
SEVERE: Unexpected error occurred in scheduled task. java.lang.NullPointerException at com.boilerplate.components.Scheduler.profit_cron(Scheduler.java:396)
This is the line 396
if(trade_prediction.equals(up) && trade_result.equals(up)) { }
What could be causing the error?