Merged V4.0-BUG-FIX to HEAD

34386: Merged V4.0 to V4.0-BUG-FIX
      34384: Fixed further merge problem
      34385: Merge V3.4-BUG-FIX (3.4.9) to V4.0 (V4.0.1)
         34381: Merged V3.4 (3.4.8) to V3.4-BUG-FIX (3.4.9)
            34378: ALF-13030 ALF-13041 Transformer Server needs filename and to make its transformer preferred over OpenOffice and JOD
               Relates to ALF-10976 and ALF-10412 set of changes
               - The last commit to make the sourceNodeRef available to the first child transformer of a ComplexContentTransformer
                 made it available to them all. 


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@34387 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Dave Ward
2012-03-02 18:33:18 +00:00
parent cb7f6f8a5f
commit 436352d8a1
2 changed files with 10 additions and 13 deletions

View File

@@ -322,7 +322,6 @@ public class ComplexContentTransformer extends AbstractContentTransformer2 imple
Iterator<ContentTransformer> transformerIterator = transformers.iterator();
Iterator<String> intermediateMimetypeIterator = intermediateMimetypes.iterator();
boolean first = true;
while (transformerIterator.hasNext())
{
ContentTransformer transformer = transformerIterator.next();
@@ -343,18 +342,19 @@ public class ComplexContentTransformer extends AbstractContentTransformer2 imple
"." + targetExt);
currentWriter = new FileContentWriter(tempFile);
currentWriter.setMimetype(nextMimetype);
// Must clear the sourceNodeRef to avoid transformers thinking the temporary file
// is the original node. Not done for the first transformer as the name will be
// correct.
if (!first)
{
options.setSourceNodeRef(null);
}
first = false;
}
// transform
transformer.transform(currentReader, currentWriter, options);
// Must clear the sourceNodeRef after the first transformation to avoid later
// transformers thinking the intermediate file is the original node. However as
// we put the original sourceNodeRef back at the end of this try block (so that we are
// not changing any data), we must setting the value to null just after the
// transformation. Really only needs to be done after the first transformation
// but doing it every time is simpler and faster.
options.setSourceNodeRef(null);
// move the source on
currentReader = currentWriter.getReader();
}