long cingrunLogFileSize = cingRunLogFile.length();
General.showDebug("cingrunLogFileSize: " + cingrunLogFileSize);
long cingrunLogFileSizeLast = 0;
if (lastLogSendFile.exists()) {
General.showDebug("Checking lastLogSendFile: " + lastLogSendFile);
StringArrayList sal = new StringArrayList();
boolean statusRead = sal.read(lastLogSendFile.toString());
lastLogSendFile.delete();
if (!statusRead) {
writeJsonError(response, result, "Failed to read the lastLogSendFile: " + lastLogSendFile);
return;
}
if (sal.size() < 1) {
writeJsonError(response, result, "Failed to read at least one line from the present lastLogSendFile: "
+ lastLogSendFile);
return;
}
String cingrunLogFileSizeLastStr = sal.getString(0);
General.showDebug("cingrunLogFileSizeLast (string): " + cingrunLogFileSizeLastStr);
cingrunLogFileSizeLast = Long.parseLong(cingrunLogFileSizeLastStr);
General.showDebug("cingrunLogFileSizeLast (long): " + cingrunLogFileSizeLast);
} else {
General.showDebug("no LAST_LOG_SEND_FILE: " + Settings.LAST_LOG_SEND_FILE);
}
// # doesn't exist because it was just removed if it even existed to start with.
StringArrayList sal = new StringArrayList();
sal.add(Long.toString(cingrunLogFileSize));
General.showDebug("writing to LAST_LOG_SEND_FILE: " + Settings.LAST_LOG_SEND_FILE);
if (!sal.write(lastLogSendFile.toString())) {
writeJsonError(response, result, "Failed to write to new lastLogSendFile: " + lastLogSendFile);
return;
}
if (cingrunLogFileSize > cingrunLogFileSizeLast) {