Skip to content
Snippets Groups Projects
Commit a4d3daaa authored by akwizgran's avatar akwizgran
Browse files

Removed a Java 1.6 API call.

parent e1ec17f4
No related branches found
No related tags found
No related merge requests found
...@@ -40,7 +40,6 @@ import net.sf.briar.api.plugins.duplex.DuplexTransportConnection; ...@@ -40,7 +40,6 @@ import net.sf.briar.api.plugins.duplex.DuplexTransportConnection;
import net.sf.briar.util.StringUtils; import net.sf.briar.util.StringUtils;
import socks.Socks5Proxy; import socks.Socks5Proxy;
import socks.SocksSocket; import socks.SocksSocket;
import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.os.Build; import android.os.Build;
import android.os.FileObserver; import android.os.FileObserver;
...@@ -275,25 +274,20 @@ class TorPlugin implements DuplexPlugin, EventHandler { ...@@ -275,25 +274,20 @@ class TorPlugin implements DuplexPlugin, EventHandler {
out.close(); out.close();
} }
@SuppressLint("NewApi")
private boolean setExecutable(File f) { private boolean setExecutable(File f) {
if(Build.VERSION.SDK_INT >= 9) { String[] command = { "chmod", "700", f.getAbsolutePath() };
return f.setExecutable(true, true); try {
} else { return Runtime.getRuntime().exec(command).waitFor() == 0;
String[] command = { "chmod", "700", f.getAbsolutePath() }; } catch(IOException e) {
try { if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
return Runtime.getRuntime().exec(command).waitFor() == 0; } catch(InterruptedException e) {
} catch(IOException e) { if(LOG.isLoggable(WARNING))
if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e); LOG.warning("Interrupted while executing chmod");
} catch(InterruptedException e) { Thread.currentThread().interrupt();
if(LOG.isLoggable(WARNING)) } catch(SecurityException e) {
LOG.warning("Interrupted while executing chmod"); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
Thread.currentThread().interrupt();
} catch(SecurityException e) {
if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
}
return false;
} }
return false;
} }
private void tryToClose(InputStream in) { private void tryToClose(InputStream in) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment