From: David G. <dgl...@us...> - 2004-12-17 16:22:21
|
Update of /cvsroot/babeldoc/babeldoc/modules/scanner/src/com/babeldoc/scanner/worker In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10376/babeldoc/modules/scanner/src/com/babeldoc/scanner/worker Modified Files: SqlScanner.java Log Message: Per vanstalle's patch request on sourceforge (ID #1007027) fix handleXmlDocuments() to only queue documents that return a non-zero resultset. I would have simply applied vanstalle's patch, but he neglected to submit it in the patch request (shame, shame! :-) ). Index: SqlScanner.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/scanner/src/com/babeldoc/scanner/worker/SqlScanner.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** SqlScanner.java 17 Oct 2003 06:41:14 -0000 1.17 --- SqlScanner.java 17 Dec 2004 16:22:01 -0000 1.18 *************** *** 176,182 **** */ public void handleXmlDocuments(ResultSet rs) throws Exception { int columnCount = rs.getMetaData().getColumnCount(); StringBuffer sb = new StringBuffer( ! "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); int rowCount = 0; --- 176,183 ---- */ public void handleXmlDocuments(ResultSet rs) throws Exception { + int columnCount = rs.getMetaData().getColumnCount(); StringBuffer sb = new StringBuffer( ! "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); int rowCount = 0; *************** *** 201,212 **** } - if (rowCount == 0) { - } - sb.append("</" + headingTag + ">\n"); - // System.out.println(sb); ! enqueue(sb.toString().getBytes("UTF-8"), ! new NameValuePair[] {new NameValuePair(SCAN_MIMETYPE_KEY, "text/xml")}); } } --- 202,213 ---- } sb.append("</" + headingTag + ">\n"); ! // only submit the document if we have any rows in the result set ! if (rowCount > 0) { ! System.out.println(sb); ! enqueue(sb.toString().getBytes("UTF-8"), ! new NameValuePair[] {new NameValuePair(SCAN_MIMETYPE_KEY, "text/xml")}); ! } } } *************** *** 293,297 **** stmt = conn.createStatement(); rs = stmt.executeQuery(sqlStatement); ! if (DOC_TYPE_CSV.equalsIgnoreCase(documentType)) { handleCsvDocument(rs); --- 294,298 ---- stmt = conn.createStatement(); rs = stmt.executeQuery(sqlStatement); ! if (DOC_TYPE_CSV.equalsIgnoreCase(documentType)) { handleCsvDocument(rs); |