String logfile = params.getChildText("file").trim();
// Security checks, this is no free proxy!!
if (logfile.startsWith("http") || logfile.startsWith("ftp")
|| logfile.startsWith("sftp")) {
throw new BadURLException(
"This is no proxy. Stopping possible hacking attempt to url: "
+ logfile);
}
if (!logfile.endsWith(".log")) {
throw new BadURLException(
"Strange suffix for this log file. Stopping possible hacking attempt to uri: "
+ logfile);
}
if (!logfile.contains("/harvester_")) {
throw new BadURLException(
"This doesn't seem like a harvester log file. Stopping possible hacking attempt to uri: "
+ logfile);
}
File file = new File(logfile);