Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8a1c0aa9 authored by Unpublished's avatar Unpublished
Browse files

Use stream with try-with-resources



Signed-off-by: default avatarUnpublished <unpublished@gmx.net>
parent 3bb6efb5
Loading
Loading
Loading
Loading
+6 −6
Original line number Original line Diff line number Diff line
@@ -221,12 +221,12 @@ public class AidlNetworkRequest extends NetworkRequest {
        request.setAccountName(getAccountName());
        request.setAccountName(getAccountName());
        request.setToken(getAccountToken());
        request.setToken(getAccountToken());


        final ByteArrayOutputStream baos = new ByteArrayOutputStream();
        InputStream is;
        final ObjectOutputStream oos = new ObjectOutputStream(baos);
        try (ByteArrayOutputStream baos = new ByteArrayOutputStream();
             ObjectOutputStream oos = new ObjectOutputStream(baos)) {
            oos.writeObject(request);
            oos.writeObject(request);
        oos.close();
            is = new ByteArrayInputStream(baos.toByteArray());
        baos.close();
        }
        final InputStream is = new ByteArrayInputStream(baos.toByteArray());


        try (ParcelFileDescriptor input = pipeFrom(is, thread -> Log.d(TAG, "copy data from service finished"))) {
        try (ParcelFileDescriptor input = pipeFrom(is, thread -> Log.d(TAG, "copy data from service finished"))) {
            return requestBodyInputStream == null
            return requestBodyInputStream == null