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;
class FileUtilsImpl implements FileUtils {
public long getFreeSpace(File f) throws IOException {
return FileSystemUtils.freeSpaceKb(f.getAbsolutePath()) * 1024;
return f.getFreeSpace();
}
}

View File

@@ -23,7 +23,7 @@ class WindowsRemovableDriveFinder implements RemovableDriveFinder {
int type = Kernel32.INSTANCE.GetDriveType(root.getPath());
if(type == DRIVE_REMOVABLE) drives.add(root);
} catch(RuntimeException e) {
throw new IOException(e.toString());
throw new IOException(e);
}
}
return Collections.unmodifiableList(drives);

View File

@@ -17,7 +17,7 @@ class SerialPortImpl implements SerialPort {
try {
if(!port.openPort()) throw new IOException("Failed to open port");
} catch(SerialPortException e) {
throw new IOException(e.toString());
throw new IOException(e);
}
}
@@ -25,7 +25,7 @@ class SerialPortImpl implements SerialPort {
try {
if(!port.closePort()) throw new IOException("Failed to close port");
} catch(SerialPortException e) {
throw new IOException(e.toString());
throw new IOException(e);
}
}
@@ -34,7 +34,7 @@ class SerialPortImpl implements SerialPort {
try {
return port.setParams(baudRate, dataBits, stopBits, parityBits);
} catch(SerialPortException e) {
throw new IOException(e.toString());
throw new IOException(e);
}
}
@@ -43,7 +43,7 @@ class SerialPortImpl implements SerialPort {
if(!port.purgePort(flags))
throw new IOException("Failed to purge port");
} catch(SerialPortException e) {
throw new IOException(e.toString());
throw new IOException(e);
}
}
@@ -51,7 +51,7 @@ class SerialPortImpl implements SerialPort {
try {
port.addEventListener(l);
} catch(SerialPortException e) {
throw new IOException(e.toString());
throw new IOException(e);
}
}
@@ -59,7 +59,7 @@ class SerialPortImpl implements SerialPort {
try {
return port.readBytes();
} catch(SerialPortException e) {
throw new IOException(e.toString());
throw new IOException(e);
}
}
@@ -67,7 +67,7 @@ class SerialPortImpl implements SerialPort {
try {
if(!port.writeBytes(b)) throw new IOException("Failed to write");
} catch(SerialPortException e) {
throw new IOException(e.toString());
throw new IOException(e);
}
}
}