File tree Expand file tree Collapse file tree 3 files changed +8
-12
lines changed
services/java/com/android/server/connectivity Expand file tree Collapse file tree 3 files changed +8
-12
lines changed Original file line number Diff line number Diff line change @@ -12446,7 +12446,7 @@ package android.net {
1244612446 method public android.net.LocalSocketAddress getLocalSocketAddress();
1244712447 }
1244812448
12449- public class LocalSocket {
12449+ public class LocalSocket implements java.io.Closeable {
1245012450 ctor public LocalSocket();
1245112451 method public void bind(android.net.LocalSocketAddress) throws java.io.IOException;
1245212452 method public void close() throws java.io.IOException;
Original file line number Diff line number Diff line change 1616
1717package android .net ;
1818
19+ import java .io .Closeable ;
1920import java .io .FileDescriptor ;
2021import java .io .IOException ;
2122import java .io .InputStream ;
2627 * Creates a (non-server) socket in the UNIX-domain namespace. The interface
2728 * here is not entirely unlike that of java.net.Socket
2829 */
29- public class LocalSocket {
30+ public class LocalSocket implements Closeable {
3031
3132 private LocalSocketImpl impl ;
3233 private volatile boolean implCreated ;
@@ -167,6 +168,7 @@ public OutputStream getOutputStream() throws IOException {
167168 *
168169 * @throws IOException
169170 */
171+ @ Override
170172 public void close () throws IOException {
171173 implCreateIfNeeded ();
172174 impl .close ();
Original file line number Diff line number Diff line change 5353import java .nio .charset .Charsets ;
5454import java .util .Arrays ;
5555
56+ import libcore .io .IoUtils ;
57+
5658/**
5759 * @hide
5860 */
@@ -228,11 +230,7 @@ public synchronized ParcelFileDescriptor establish(VpnConfig config) {
228230 mConnection = connection ;
229231 mInterface = interfaze ;
230232 } catch (RuntimeException e ) {
231- try {
232- tun .close ();
233- } catch (Exception ex ) {
234- // ignore
235- }
233+ IoUtils .closeQuietly (tun );
236234 throw e ;
237235 }
238236 Log .i (TAG , "Established by " + config .user + " on " + mInterface );
@@ -442,11 +440,7 @@ public void exit() {
442440 // We assume that everything is reset after stopping the daemons.
443441 interrupt ();
444442 for (LocalSocket socket : mSockets ) {
445- try {
446- socket .close ();
447- } catch (Exception e ) {
448- // ignore
449- }
443+ IoUtils .closeQuietly (socket );
450444 }
451445 }
452446
You can’t perform that action at this time.
0 commit comments