protected ScanCheckResultBean testSAXInput(DefaultHandler handler) {
log.debug("Starting SAX Test.");
if (channelTypeDao == null) {
log.error("Spring configuration didn't have an entry for ChannelTypeDao.");
return new ScanCheckResultBean(ScanImportStatus.CONFIGURATION_ERROR);
}
if (inputStream == null) {
log.warn(ScanImportStatus.NULL_INPUT_ERROR.toString());
return new ScanCheckResultBean(ScanImportStatus.NULL_INPUT_ERROR);
}
if (doSAXExceptionCheck) {
if (ScanUtils.isBadXml(inputStream)) {
log.warn("Bad XML format - ensure correct, uniform encoding.");
return new ScanCheckResultBean(ScanImportStatus.BADLY_FORMED_XML);
}
closeInputStream(inputStream);
try {
inputStream = new FileInputStream(inputFileName);
} catch (FileNotFoundException e) {
log.error("Cannot find file '" + inputFileName + "'.", e);
}
}
ScanUtils.readSAXInput(handler, FILE_CHECK_COMPLETED, inputStream);
closeInputStream(inputStream);
log.info("Scan status: " + testStatus);
return new ScanCheckResultBean(testStatus, testDate);
}