Author: borges
Date: 2012-02-03 08:27:19 -0500 (Fri, 03 Feb 2012)
New Revision: 12079
Modified:
trunk/hornetq-journal/src/main/java/org/hornetq/core/journal/impl/AbstractSequentialFile.java
Log:
Restore: check returned codes, fixes findbugs warnings.
Modified:
trunk/hornetq-journal/src/main/java/org/hornetq/core/journal/impl/AbstractSequentialFile.java
===================================================================
---
trunk/hornetq-journal/src/main/java/org/hornetq/core/journal/impl/AbstractSequentialFile.java 2012-02-03
13:26:59 UTC (rev 12078)
+++
trunk/hornetq-journal/src/main/java/org/hornetq/core/journal/impl/AbstractSequentialFile.java 2012-02-03
13:27:19 UTC (rev 12079)
@@ -23,6 +23,7 @@
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.api.core.HornetQBuffers;
+import org.hornetq.api.core.HornetQException;
import org.hornetq.core.journal.EncodingSupport;
import org.hornetq.core.journal.IOAsyncTask;
import org.hornetq.core.journal.SequentialFile;
@@ -102,9 +103,12 @@
close();
}
- file.delete();
+ if (!file.delete())
+ {
+ log.error("Failed to delete file " + this);
+ }
}
-
+
public void copyTo(SequentialFile newFileName) throws Exception
{
log.debug("Copying " + this + " as " + newFileName);
@@ -113,10 +117,10 @@
{
this.open();
}
-
-
+
+
ByteBuffer buffer = ByteBuffer.allocate(10 * 1024);
-
+
for (;;)
{
buffer.rewind();
@@ -148,7 +152,11 @@
if (!file.equals(newFile))
{
- file.renameTo(newFile);
+ if (!file.renameTo(newFile))
+ {
+ throw new HornetQException(HornetQException.IO_ERROR, "failed to rename
file " + file.getName() + " to " +
+ newFileName);
+ }
file = newFile;
}
}
Show replies by date