Reverted some changes that were made for Java 1.5 compatibility.

Removed Commons IO, which we were only using as a replacement for
File.getFreeSpace() on desktop plaftorms.

Note: The Huawei U8210 (Android 2.1) doesn't have all the Java 1.6
standard library methods, and crashes if they're called. Specifically,
String.isEmpty() and NetworkInterface.supportsMulticast() are missing,
so the changes removing those methods were not reverted.
This commit is contained in:
akwizgran
2013-11-22 12:49:20 +00:00
parent 3b5769cf8a
commit 26eebee8d9
11 changed files with 30 additions and 35 deletions

View File

@@ -5,11 +5,9 @@ import java.io.IOException;
import net.sf.briar.api.os.FileUtils;
import org.apache.commons.io.FileSystemUtils;
public class TestFileUtils implements FileUtils {
public long getFreeSpace(File f) throws IOException {
return FileSystemUtils.freeSpaceKb(f.getAbsolutePath()) * 1024;
return f.getFreeSpace();
}
}

View File

@@ -674,8 +674,7 @@ public abstract class DatabaseComponentTest extends BriarTestCase {
final byte[] raw1 = new byte[size];
final Collection<MessageId> sendable = Arrays.asList(messageId,
messageId1);
final Collection<byte[]> messages =
Arrays.asList(new byte[][] {raw, raw1});
final Collection<byte[]> messages = Arrays.asList(raw, raw1);
final Map<MessageId, Integer> sent = new HashMap<MessageId, Integer>();
sent.put(messageId, 1);
sent.put(messageId1, 2);

View File

@@ -42,7 +42,6 @@ import net.sf.briar.api.messaging.MessageId;
import net.sf.briar.api.transport.Endpoint;
import net.sf.briar.api.transport.TemporarySecret;
import org.apache.commons.io.FileSystemUtils;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -545,8 +544,7 @@ public class H2DatabaseTest extends BriarTestCase {
Database<Connection> db = open(false);
// Sanity check: there should be enough space on disk for this test
String path = testDir.getAbsolutePath();
assertTrue(FileSystemUtils.freeSpaceKb(path) * 1024 > MAX_SIZE);
assertTrue(testDir.getFreeSpace() > MAX_SIZE);
// The free space should not be more than the allowed maximum size
long free = db.getFreeSpace();