IOUtils.java

1
/*
2
 * Copyright 2020 Hazelcast Inc.
3
 *
4
 * Licensed under the Hazelcast Community License (the "License"); you may not use
5
 * this file except in compliance with the License. You may obtain a copy of the
6
 * License at
7
 *
8
 * http://hazelcast.com/hazelcast-community-license
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
 * WARRANTIES OF ANY KIND, either express or implied. See the License for the
13
 * specific language governing permissions and limitations under the License.
14
 */
15
16
package com.hazelcast.zookeeper;
17
18
import org.slf4j.Logger;
19
import org.slf4j.LoggerFactory;
20
21
import java.io.Closeable;
22
import java.io.IOException;
23
24
/**
25
 * The type IO utils.
26
 */
27
public final class IOUtils {
28
29
    private static final Logger LOGGER = LoggerFactory.getLogger(IOUtils.class);
30
31
    private IOUtils() {
32
    }
33
34
    /**
35
     * Close safely.
36
     *
37
     * @param closeable the closeable
38
     */
39
    public static void closeSafely(Closeable closeable) {
40 1 1. closeSafely : negated conditional → KILLED
        if (closeable != null) {
41
            try {
42 1 1. closeSafely : removed call to java/io/Closeable::close → KILLED
                closeable.close();
43
            } catch (IOException e) {
44
                LOGGER.debug("Error while closing " + closeable, e);
45
            }
46
        }
47
    }
48
}

Mutations

40

1.1
Location : closeSafely
Killed by : com.hazelcast.zookeeper.IOUtilsTest.testCloseSafely_nullSafety(com.hazelcast.zookeeper.IOUtilsTest)
negated conditional → KILLED

42

1.1
Location : closeSafely
Killed by : com.hazelcast.zookeeper.IOUtilsTest.testCloseSafely(com.hazelcast.zookeeper.IOUtilsTest)
removed call to java/io/Closeable::close → KILLED

Active mutators

Tests examined


Report generated by PIT 1.7.3