I have a class file which when i compile shows me Null pointer exception in a particular line all the time. I handled null check as below.
108    doc = Jsoup.parse(html, brandUrl);
109    Element div = doc.getElementById("eventTTL");
110    String attr = div.attr("eventTTL");
111    Date closingDate = new Date(Long.parseLong(attr));
112    Elements mainForm = doc.select("div#main-form");
113    Elements mainDivs = mainForm.select("DIV");
java.lang.NullPointerException at com.textT.at.Chickyur.main(Chickyur.java:110)
if(div != null)
String attr = div.attr("eventTTL"); 
 Also tried 
 if(div.attr("eventTTL") != null)
 String attr = div.attr("eventTTL"); 
Still i keep getting the exceptions. What is wrong? any thoughts?
 
     
     
    