You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by no...@apache.org on 2015/02/27 14:10:43 UTC

svn commit: r1662678 - in /lucene/dev/branches/branch_5x: ./ solr/ solr/core/ solr/core/src/java/org/apache/solr/core/SolrResourceLoader.java

Author: noble
Date: Fri Feb 27 13:10:42 2015
New Revision: 1662678

URL: http://svn.apache.org/r1662678
Log:
SOLR-7168: Test failure :Could not remove the files in windows

Modified:
    lucene/dev/branches/branch_5x/   (props changed)
    lucene/dev/branches/branch_5x/solr/   (props changed)
    lucene/dev/branches/branch_5x/solr/core/   (props changed)
    lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/core/SolrResourceLoader.java

Modified: lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/core/SolrResourceLoader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/core/SolrResourceLoader.java?rev=1662678&r1=1662677&r2=1662678&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/core/SolrResourceLoader.java (original)
+++ lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/core/SolrResourceLoader.java Fri Feb 27 13:10:42 2015
@@ -797,7 +797,6 @@ public class SolrResourceLoader implemen
   public static void persistConfLocally(SolrResourceLoader loader, String resourceName, byte[] content) {
     // Persist locally
     File confFile = new File(loader.getConfigDir(), resourceName);
-    OutputStream out = null;
     try {
       File parentDir = confFile.getParentFile();
       if ( ! parentDir.isDirectory()) {
@@ -807,17 +806,17 @@ public class SolrResourceLoader implemen
           throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, msg);
         }
       }
-      out = new FileOutputStream(confFile);
-      out.write(content);
+      try (OutputStream out = new FileOutputStream(confFile);) {
+        out.write(content);
+      }
       log.info("Written confile " + resourceName);
     } catch (IOException e) {
       final String msg = "Error persisting conf file " + resourceName;
       log.error(msg, e);
       throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, msg, e);
     } finally {
-      org.apache.commons.io.IOUtils.closeQuietly(out);
       try {
-        FileUtils.sync(confFile);
+        IOUtils.fsync(confFile.toPath(), false);
       } catch (IOException e) {
         final String msg = "Error syncing conf file " + resourceName;
         log.error(msg, e);