Here you can find the source of closeSilently(@WillClose Connection c)
public static void closeSilently(@WillClose Connection c)
//package com.java2s; /*//from w ww . j a va 2s.c o m * FindBugs - Find Bugs in Java programs * Copyright (C) 2006, University of Maryland * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import java.io.Closeable; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.Reader; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.zip.ZipFile; import javax.annotation.WillClose; public class Main { public static void closeSilently(@WillClose Connection c) { try { if (c != null) { c.close(); } } catch (SQLException e) { assert true; } } public static void closeSilently(@WillClose PreparedStatement c) { try { if (c != null) { c.close(); } } catch (SQLException e) { assert true; } } public static void closeSilently(@WillClose ResultSet c) { try { if (c != null) { c.close(); } } catch (SQLException e) { assert true; } } public static void closeSilently(@WillClose InputStream in) { try { if (in != null) { in.close(); } } catch (IOException e) { assert true; } } public static void closeSilently(@WillClose Reader in) { try { if (in != null) { in.close(); } } catch (IOException e) { assert true; } } public static void closeSilently(@WillClose OutputStream out) { try { if (out != null) { out.close(); } } catch (IOException e) { assert true; } } public static void closeSilently(@WillClose Closeable out) { try { if (out != null) { out.close(); } } catch (IOException e) { assert true; } } public static void closeSilently(@WillClose ZipFile zip) { try { if (zip != null) { zip.close(); } } catch (IOException e) { assert true; } } }