SOLR-2331: fix Windows file deletion failure due to a lock held by an unclosed anonymous input stream created for the purpose of debug printing; also, wrap the debug printing in an 'if (VERBOSE) { }' block so that it doesn't get ordinarily get invoked.

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1144088 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Steven Rowe 2011-07-07 22:56:20 +00:00
parent dd55ad4397
commit 28dab8437f
1 changed files with 9 additions and 2 deletions

View File

@ -202,8 +202,15 @@ public class TestSolrProperties extends LuceneTestCase {
assertTrue("should have more recent time: " + after + "," + before, after > before);
mcr = CoreAdminRequest.persist("solr-persist.xml", coreadmin);
System.out.println(IOUtils.toString(new FileInputStream(new File(solrXml.getParent(), "solr-persist.xml"))));
if (VERBOSE) {
FileInputStream fis = new FileInputStream(new File(solrXml.getParent(), "solr-persist.xml"));
try {
System.out.println(IOUtils.toString(fis));
} finally {
fis.close();
}
}
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
FileInputStream fis = new FileInputStream(new File(solrXml.getParent(), "solr-persist.xml"));
try {