I have some code which is generating exceptions, apparently before the code itself starts. I have no idea how to deal with this. Here's the output:
Exception in_ sendUnsentNaggregation java.lang.NullPointerException
unsent: 0
unsent:
unsent:1
// --------------------------------------------------------------------
private void sendUnsentNaggregation()
{
System.err.println("unsent: 0\n");
try {
log("unsent:");
DateTime today=new DateTime();
String nagID=String.format("Naggregation for %4d/%02d/%02d",today.getYear(),today.getMonthOfYear(),today.getDayOfMonth());
log("unsent:1");
Database.UniqueString uniqueNagID=db.new UniqueString(nagID,MAX_URL_SIZE);
boolean alreadyThere=db.scannedURLs.indexOf(uniqueNagID)>=0;
log("nagID "+nagID+" unique "+uniqueNagID+" today "+today);
// wait until the naps site has stabilised
boolean okayToSend=(today.getHourOfDay()>=5) && (today.getMinuteOfHour()>=55); // send at 5:55
if(nagNeedsSending.isSelected() || (!alreadyThere && okayToSend)){
String status=String.format("\nSending %s %s at %02d:%02d\n",(sendTestOnly.isSelected() ? "test " : "actual "),nagID,today.getHourOfDay(),today.getMinuteOfHour());
browserPanel.append(status);
scanner.updateNapsters(napsterROIThreshold.getText(),napsterSampleSize.getText(),napsterType.getSelectedIndex());
if(sentNaggregation(sendTestOnly.isSelected())){
if(!alreadyThere) db.scannedURLs.add(uniqueNagID);
} else {
browserPanel.append("Naggregation not sent\n");
}
}
} catch (IllegalSearch ex) {
log("Illegal search in sendUnsentNaggregation");
} catch (FileException ex) {
log("FileException in sendUnsentNaggregation");
} catch(Exception e) {
log("Exception in_ sendUnsentNaggregation "+e);
}
}
// --------------------------------------------------------------------