[jboss-svn-commits] JBL Code SVN: r38247 - labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/util.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Nov 15 15:02:13 EST 2012


Author: tcunning
Date: 2012-11-15 15:02:12 -0500 (Thu, 15 Nov 2012)
New Revision: 38247

Modified:
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/util/FileUtil.java
Log:
JBESB-3879
Handle failed file rename better in FileUtil.move.


Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/util/FileUtil.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/util/FileUtil.java	2012-11-15 17:48:42 UTC (rev 38246)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/util/FileUtil.java	2012-11-15 20:02:12 UTC (rev 38247)
@@ -110,14 +110,14 @@
 
         if(!from.renameTo(fromLocalRename))
         {
-                LOGGER.debug("Unable to perform local rename of file '" + from.getAbsolutePath() + "' to '" + fromLocalRename.getAbsolutePath() + "'.  Unable to move file.");
-                return true;
+            LOGGER.debug("Unable to perform local rename of file '" + from.getAbsolutePath() + "' to '" + fromLocalRename.getAbsolutePath() + "'.  Unable to move file.");
+            return false;
         }
 
         if(!fromLocalRename.exists())
         {
             LOGGER.debug("Failed to perform local rename of file '" + from.getAbsolutePath() + "' to '" + fromLocalRename.getAbsolutePath() + "'.  Unable to move file.");
-            return true;
+            return false;
         }
 
         final File tmpFile ;
@@ -128,7 +128,7 @@
         catch (final IOException ioe)
         {
             LOGGER.debug("Could not create temporary file for writing", ioe) ;
-            return true;
+            return false;
         }
 
         try
@@ -206,18 +206,18 @@
             }
             finally
             {
-                    try
-                    {
-                            fos.close();
-                    }
-                    catch (final IOException ioe) {} // ignore
+                try
+                {
+                    fos.close();
+                }
+                catch (final IOException ioe) {} // ignore
             }
         }
         finally
         {
             try
             {
-                    fis.close();
+                fis.close();
             }
             catch (final IOException ioe) {} // ignore
         }
@@ -235,7 +235,7 @@
         StringBuffer sb = new StringBuffer(1024);
         BufferedReader reader = new BufferedReader(new FileReader(file.getPath()));
         char[] chars = new char[1];
-        while( (reader.read(chars)) > -1){
+        while( (reader.read(chars)) > -1) {
             sb.append(String.valueOf(chars)); 
             chars = new char[1];
         }



More information about the jboss-svn-commits mailing list