Commit 15f97bbb authored by Alexander Martinz's avatar Alexander Martinz Committed by Michael Bestas

ImageCache: add missing close call and cleanup

Change-Id: Id75ae226307c1045d2533e4f61443aee3d076c3e
Signed-off-by: default avatarAlexander Martinz <amartinz@shiftphones.com>
parent 5160a2b7
/*
* Copyright (C) 2019 The LineageOS Project
* Copyright (C) 2019 SHIFT GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.lineageos.eleven.utils;
import android.support.annotation.Nullable;
import java.io.Closeable;
import java.net.Socket;
public class IoUtils {
public static void closeQuietly(@Nullable final Object object) {
try {
if (object instanceof Socket) {
((Socket) object).close();
} else if (object instanceof Closeable) {
((Closeable) object).close();
}
} catch (Exception ignored) {
// ignored
}
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment