mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-08 14:51:49 +00:00
Rolled back CIFSComparator stuff incorrectly checked in
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@118826 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -313,9 +313,9 @@ public class CIFSContentComparator implements ContentComparator
|
|||||||
private class PPTContentComparator implements ContentComparator
|
private class PPTContentComparator implements ContentComparator
|
||||||
{
|
{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isContentEqual(ContentReader existingContent, File newFile)
|
public boolean isContentEqual(ContentReader existingContent, File newFile)
|
||||||
{
|
{
|
||||||
long fileSizesDifference = newFile.length() - existingContent.getSize();
|
long fileSizesDifference = newFile.length() - existingContent.getSize();
|
||||||
|
|
||||||
if(logger.isDebugEnabled())
|
if(logger.isDebugEnabled())
|
||||||
@@ -352,47 +352,19 @@ public boolean isContentEqual(ContentReader existingContent, File newFile)
|
|||||||
|
|
||||||
if (lastEditUsername1.equals(lastEditUsername2))
|
if (lastEditUsername1.equals(lastEditUsername2))
|
||||||
{
|
{
|
||||||
logger.debug("powerpoint files are different size and same editor name");
|
logger.debug("powerpoint files are different size");
|
||||||
// Different size
|
// Different size
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//make sure that nothing has been changed except lastEditUsername
|
//make sure that nothing has been changed except lastEditUsername
|
||||||
|
|
||||||
tpm1 = TempFileProvider.createTempFile("CIFSContentComparator1", "ppt");
|
tpm1 = TempFileProvider.createTempFile("CIFSContentComparator1", "ppt");
|
||||||
FileOutputStream os = new FileOutputStream(tpm1);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
slideShow1.write(os);
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
os.close();
|
|
||||||
}
|
|
||||||
catch (IOException ie)
|
|
||||||
{
|
|
||||||
// ignore
|
|
||||||
}
|
|
||||||
}
|
|
||||||
tpm2 = TempFileProvider.createTempFile("CIFSContentComparator2", "ppt");
|
tpm2 = TempFileProvider.createTempFile("CIFSContentComparator2", "ppt");
|
||||||
FileOutputStream os2 = new FileOutputStream(tpm2);
|
|
||||||
try
|
slideShow1.write(new FileOutputStream(tpm1));
|
||||||
{
|
slideShow1.write(new FileOutputStream(tpm2));
|
||||||
slideShow2.write(os2);
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
os2.close();
|
|
||||||
}
|
|
||||||
catch (IOException ie)
|
|
||||||
{
|
|
||||||
// ignore
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
NPOIFSFileSystem fs1 = new NPOIFSFileSystem(tpm1);
|
NPOIFSFileSystem fs1 = new NPOIFSFileSystem(tpm1);
|
||||||
NPOIFSFileSystem fs2 = new NPOIFSFileSystem(tpm2);
|
NPOIFSFileSystem fs2 = new NPOIFSFileSystem(tpm2);
|
||||||
@@ -450,9 +422,6 @@ public boolean isContentEqual(ContentReader existingContent, File newFile)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -304,19 +304,19 @@ public class CIFSContentComparatorTest extends TestCase
|
|||||||
ClassPathResource file5Resource = new ClassPathResource("filesys/ContentComparatorTestPowerPoint2003-5-edited-gt-3072bytes.ppt");
|
ClassPathResource file5Resource = new ClassPathResource("filesys/ContentComparatorTestPowerPoint2003-5-edited-gt-3072bytes.ppt");
|
||||||
assertNotNull("unable to find test resource filesys/ContentComparatorTestPowerPoint2003-5-edited-gt-3072bytes.ppt", file5Resource);
|
assertNotNull("unable to find test resource filesys/ContentComparatorTestPowerPoint2003-5-edited-gt-3072bytes.ppt", file5Resource);
|
||||||
|
|
||||||
// /**
|
/**
|
||||||
// * Compare different powerpoint files, should not be ignored
|
* Compare different powerpoint files, should not be ignored
|
||||||
// */
|
*/
|
||||||
// {
|
{
|
||||||
// File file0 = file0Resource.getFile();
|
File file0 = file0Resource.getFile();
|
||||||
// File file1 = file1Resource.getFile();
|
File file1 = file1Resource.getFile();
|
||||||
//
|
|
||||||
// ContentReader reader = new FileContentReader(file0);
|
ContentReader reader = new FileContentReader(file0);
|
||||||
// reader.setMimetype("application/vnd.ms-powerpoint");
|
reader.setMimetype("application/vnd.ms-powerpoint");
|
||||||
// reader.setEncoding("UTF-8");
|
reader.setEncoding("UTF-8");
|
||||||
// boolean result = contentComparator.isContentEqual(reader, file1);
|
boolean result = contentComparator.isContentEqual(reader, file1);
|
||||||
// assertTrue("compare different powerpoint files, should not be equal", !result);
|
assertTrue("compare different powerpoint files, should not be equal", !result);
|
||||||
// }
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compare trivially different powerpoint files, should ignore trivial differences and be equal
|
* Compare trivially different powerpoint files, should ignore trivial differences and be equal
|
||||||
|
Reference in New Issue
Block a user