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

Unverified Commit b951a2a6 authored by Tobias Kaminsky's avatar Tobias Kaminsky Committed by GitHub
Browse files

Merge pull request #544 from nextcloud/try-with-resources

Use stream with try-with-resources
parents b4e587a0 8a1c0aa9
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -221,12 +221,12 @@ public class AidlNetworkRequest extends NetworkRequest {
        request.setAccountName(getAccountName());
        request.setToken(getAccountToken());

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

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