if (applyPathRecognition) {
if (pathRecogniser != null) {
try {
recognisedPath = pathRecogniser.recognisePath(meta.getURI());
} catch (ResourceMigrationException e) {
throw new ResourceMigrationException("Error recognising path " +
"for type " + getName(), e);
}
}
// else, user has asked for path recognition but this type does not
// support it, so we skip it. This just means that things run a bit
// slower.
// todo: add a debug log here? does this use notification?
}
if (recognisedPath || !applyPathRecognition) {
Version identifiedVersion = null;
Iterator contentRecognisersIterator = contentIdentifiers.iterator();
while (contentRecognisersIterator.hasNext()) {
input.restart();
ContentIdentifier contentRecogniser =
(ContentIdentifier) contentRecognisersIterator.next();
// todo: later: potentially a recognition exception should not
// always be fatal. It may be that there are multiple
// recognisers for a path and that one of the ones that throws
// an exception is not the one that actually recognises the
// content. In this case we could log the error, continue on,
// and only fail if there is no match in the end.
boolean identifiedContent;
try {
identifiedContent = contentRecogniser.identifyContent(input);
} catch (Exception e) {
throw new ResourceMigrationException("Error identifying " +
"content for type " + getName() + " version " +
contentRecogniser.getVersion().getName(), e);
}
if (identifiedContent) {