* {@inheritDoc}
*/
@Override
@Transactional(propagation = Propagation.REQUIRED)
public void handleError(IdentificationException e) {
final IdentificationRequest request = e.getRequest();
final RequestIdentifier identifier = request.getIdentifier();
URI uri = identifier.getUri();
//log.debug(String.format("handling error for job [%s]", uri));
final Long nodeId = identifier.getNodeId();
ProfileResourceNode node;
if (nodeId != null) {
node = resultHandlerDao.loadNode(nodeId);
node.getMetaData().setNodeStatus(NodeStatus.ERROR);
// Need to initialise the collection eagerly...
node.getFormatIdentifications().size();
} else {
node = new ProfileResourceNode(uri);
node.setFinished(new Date());
final NodeMetaData metaData = node.getMetaData();
metaData.setNodeStatus(getNodeStatus(e.getErrorType()));
metaData.setResourceType(ResourceType.FILE);
node.setNoFormatsIdentified();
RequestMetaData requestMetaData = request.getRequestMetaData();
metaData.setName(requestMetaData.getName());
metaData.setSize(requestMetaData.getSize());
metaData.setExtension(request.getExtension());
metaData.setLastModified(request.getRequestMetaData().getTime());
metaData.setHash(requestMetaData.getHash());
node.addFormatIdentification(Format.NULL);
resultHandlerDao.save(node, identifier.getParentResourceId());
}