Here is my code:
ResultSet res = con.query("USE VSM; SELECT max(EmailTime) FROM Emails;");
if( ! res.next()) { lastEmailTime = new Date(0); } // if table empty set last email time to 1970
else { lastEmailTime = SQLServer.sdf.parse(res.getString(1)); } //SQL is 1-indexed
My table is currently empty, and yet the code in the else statement is running. I know this because I'm getting a null pointer exception about it trying to access the res.getString(1). Why is it failing the if condition??