void closeQuietly(InputStream is){ try { if (is != null) { is.close(); } } catch (IOException ignored) { } } /** * close a stream with no error thrown * @param os - OutputStream (may be null) */ public static void closeQuietly(OutputStream os){ try { if (os != null) { os.close(); } } catch (IOException ignored) { } } /** * close a Writer with no error thrown * @param wr - Writer (may be null) */ public static void closeQuietly(Writer wr){ try { if (wr != null) { wr.close(); } } catch (IOException ignored) { } } /** * close a Reader with no error thrown * @param rd - Reader (may be null) */ public static void closeQuietly(Reader rd){ try { if (rd != null) { rd.close(); } } catch (IOException ignored) { } }
void closeQuietly(OutputStream os){ try { if (os != null) { os.close(); } } catch (IOException ignored) { } } /** * close a Writer with no error thrown * @param wr - Writer (may be null) */ public static void closeQuietly(Writer wr){ try { if (wr != null) { wr.close(); } } catch (IOException ignored) { } } /** * close a Reader with no error thrown * @param rd - Reader (may be null) */ public static void closeQuietly(Reader rd){ try { if (rd != null) { rd.close(); } } catch (IOException ignored) { } } /** * close a Socket with no error thrown * @param sock - Socket (may be null) */ public static void closeQuietly(Socket sock){ try { if (sock!= null) { sock.close(); } } catch (IOException ignored) { } }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jorphan/util/JOrphanUtils.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jorphan/util/JOrphanUtils.java
Method name: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
1
void closeQuietly(InputStream is){
2
        try {
3
            if (is != null) {
4
                is.close();
5
            }
6
        } catch (IOException ignored) {
7
        }
8
    }
9
    /**
10
     * close a stream with no error thrown
11
     * @param os - OutputStream (may be null)
12
     */
13
    public static void closeQuietly(OutputStream os){
1
void closeQuietly(OutputStream os){
14
        try {
2
        try {
15
            if (os != null) {
3
            if (os != null) {
16
                os.close();
4
                os.close();
17
            }
5
            }
18
        } catch (IOException ignored) {
6
        } catch (IOException ignored) {
19
        }
7
        }
20
    }
8
    }
21
    /**
9
    /**
22
     * close a Writer with no error thrown
10
     * close a Writer with no error thrown
23
     * @param wr - Writer (may be null)
11
     * @param wr - Writer (may be null)
24
     */
12
     */
25
    public static void closeQuietly(Writer wr){
13
    public static void closeQuietly(Writer wr){
26
        try {
14
        try {
27
            if (wr != null) {
15
            if (wr != null) {
28
                wr.close();
16
                wr.close();
29
            }
17
            }
30
        } catch (IOException ignored) {
18
        } catch (IOException ignored) {
31
        }
19
        }
32
    }
20
    }
33
    /**
21
    /**
34
     * close a Reader with no error thrown
22
     * close a Reader with no error thrown
35
     * @param rd - Reader (may be null)
23
     * @param rd - Reader (may be null)
36
     */
24
     */
37
    public static void closeQuietly(Reader rd){
25
    public static void closeQuietly(Reader rd){
38
        try {
26
        try {
39
            if (rd != null) {
27
            if (rd != null) {
40
                rd.close();
28
                rd.close();
41
            }
29
            }
42
        } catch (IOException ignored) {
30
        } catch (IOException ignored) {
43
        }
31
        }
44
    }
32
    }
33
    /**
34
     * close a Socket with no error thrown
35
     * @param sock - Socket (may be null)
36
     */
37
    public static void closeQuietly(Socket sock){
38
        try {
39
            if (sock!= null) {
40
                sock.close();
41
            }
42
        } catch (IOException ignored) {
43
        }
44
    }
Summary
Number of common nesting structure subtrees0
Number of refactorable cases0
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones location
Number of node comparisons0