sb.append(", "); sb.append(iter.next().toString());
sb.append(", '");  BigInteger serno = (BigInteger)iter.next(); sb.append(serno.toString()); sb.append("'");
	public Collection findCertificatesByIssuerAndSernos(Admin admin, String issuerDN, Collection sernos) {		debug(">findCertificateByIssuerAndSernos()");		Connection con = null;		PreparedStatement ps = null;		ResultSet result = null;		ArrayList vect = null;		if (null == admin) {			throw new IllegalArgumentException();		}		if (null == issuerDN || issuerDN.length() <= 0			|| null == sernos || sernos.isEmpty()) {			return new ArrayList();		}		String dn = CertTools.stringToBCDNString(issuerDN);		debug("Looking for cert with (transformed)DN: " + dn);		try {			final StringBuffer sb = new StringBuffer();			/*			 * tmeckel:			 * JBoss seems to have problems loading anoymous classes :(			 * i always get an java.lang.NoClassDefFound exception when			 * i try to use the following code snipped			 *			 * the code in the following block is only a dingy			 * replacement as long as the problem with anonymous			 * classes are solved :)			CollectionUtils.forAllDo(sernos, new Closure() {												public void execute(Object input) {													if (null != input) {														sb.append(", ");														sb.append(input.toString());													}												}} );			*/			{				Iterator iter = sernos.iterator();				while (iter.hasNext()) {					sb.append(", ");					sb.append(iter.next().toString());				}			}			/*			 * to save the repeating if-statement in the above			 * Closure not to add ', ' as the first characters			 * in the StringBuffer we remove the two chars here :)			 */			sb.delete(0, ", ".length());			con = getConnection();			ps = con.prepareStatement("SELECT DISTINCT fingerprint"									  + " FROM CertificateData WHERE"									  + " issuerDN = ?"									  + " AND serialNumber IN (" + sb.toString() + ")");            ps.setString(1,dn);			result = ps.executeQuery();			vect = new ArrayList();			while (result.next()) {                Certificate cert = findCertificateByFingerprint(admin, result.getString(1));                if (cert != null) {                    vect.add(cert);                                    } 			}			debug("<findCertificateByIssuerAndSernos()");			return vect;		} catch (Exception fe) {			throw new EJBException(fe);		} finally {		   try {				if (result != null) result.close();				if (ps != null) ps.close();				if (con != null) con.close();			} catch (SQLException se) {				error("Unable to cleanup after : findCertificateByIssuerAndSernos()", se);			}		}	} // findCertificateByIssuerAndSernos