Fixes AMQ-6441 where a negative value can be returned with large AWS EFS files systems when calling java.io.File.getTotalSpace()

This commit is contained in:
William Crowell 2016-09-29 08:22:46 -04:00 committed by gtully
parent dc68ad8967
commit f225120f61
1 changed files with 25 additions and 0 deletions

View File

@ -0,0 +1,25 @@
package org.apache.activemq.util;
import java.io.File;
/**
* @author wcrowell
*
* LargeFile is used to simulate a large file system (e.g. exabytes in size).
* The getTotalSpace() method is intentionally set to exceed the largest
* value of a primitive long which is 9,223,372,036,854,775,807. A negative
* number will be returned when getTotalSpace() is called. This class is for
* test purposes only. Using a mocking framework to mock the behavior of
* java.io.File was a lot of work.
*
*/
public class LargeFile extends File {
public LargeFile(File parent, String child) {
super(parent, child);
}
@Override
public long getTotalSpace() {
return Long.MAX_VALUE + 4193L;
}
}