mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-16 04:39:54 +01:00
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:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user