mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
ALF-17703: TikaPowerMetadataExtracter Destroys Content on Failed Embed
- Removed catch of exception and closing of output stream in TikaPoweredMetadataExtracter to allow AbstractMappingMetadataExtracter to better handle the error - Added catch of ContentIOException during construction of error details in AbstractMappingMetadataExtracter - Added ContentMetadataEmbedderTest to test a failing embedder git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@45949 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -42,6 +42,7 @@ import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||
import org.alfresco.service.cmr.dictionary.PropertyDefinition;
|
||||
import org.alfresco.service.cmr.repository.ContentIOException;
|
||||
import org.alfresco.service.cmr.repository.ContentReader;
|
||||
import org.alfresco.service.cmr.repository.ContentWriter;
|
||||
import org.alfresco.service.cmr.repository.MalformedNodeRefException;
|
||||
@@ -1115,11 +1116,18 @@ abstract public class AbstractMappingMetadataExtracter implements MetadataExtrac
|
||||
{
|
||||
// Ask Tika to detect the document, and report back on if
|
||||
// the current mime type is plausible
|
||||
String typeErrorMessage = null;
|
||||
String typeErrorMessage = "";
|
||||
String differentType = null;
|
||||
if(mimetypeService != null)
|
||||
{
|
||||
differentType = mimetypeService.getMimetypeIfNotMatches(writer.getReader());
|
||||
try
|
||||
{
|
||||
differentType = mimetypeService.getMimetypeIfNotMatches(writer.getReader());
|
||||
}
|
||||
catch (ContentIOException cioe)
|
||||
{
|
||||
// Embedding failed and writer is empty
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1144,7 +1152,7 @@ abstract public class AbstractMappingMetadataExtracter implements MetadataExtrac
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.warn(
|
||||
logger.error(
|
||||
"Metadata embedding failed (turn on DEBUG for full error): \n" +
|
||||
" Extracter: " + this + "\n" +
|
||||
" Content: " + writer + "\n" +
|
||||
|
Reference in New Issue
Block a user