Replace two redundant methods in OPCPackageDetector
Remove two private methods : `closeQuietly(ZipFile)`, `closeQuietly(ZipEntrySource)`.
Replace call with method `closeQuietly(Closeable)` from commons-compress.
@@ -52,6 +52,8 @@ import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.regex.Pattern;
+import static org.apache.commons.compress.utils.IOUtils.closeQuietly;
+
public class OPCPackageDetector implements ZipContainerDetector {
@@ -245,28 +247,6 @@ public class OPCPackageDetector implements ZipContainerDetector {
return MediaType.parse(docType);
}
- private static void closeQuietly(ZipFile zipFile) {
- if (zipFile == null) {
- return;
- }
- try {
- zipFile.close();
- } catch (IOException e) {
-
- }
- }
-
- private static void closeQuietly(ZipEntrySource zipEntrySource) {
- if (zipEntrySource == null) {
- return;
- }
- try {
- zipEntrySource.close();
- } catch (IOException e) {
- //swallow
- }
- }
-
@Override
public MediaType streamingDetectUpdate(ZipArchiveEntry zae, InputStream zis, StreamingDetectContext detectContext) {
String name = zae.getName();
