activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1415725 - /activemq/trunk/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/disk/journal/DataFile.java
Date Fri, 30 Nov 2012 16:15:58 GMT
Author: tabish
Date: Fri Nov 30 16:15:57 2012
New Revision: 1415725

URL: http://svn.apache.org/viewvc?rev=1415725&view=rev
Log:
fix for: https://issues.apache.org/jira/browse/AMQ-4171 

use the getCanonicalPath() value to ensure valid pathnames being used on the platform. 

Modified:
    activemq/trunk/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/disk/journal/DataFile.java

Modified: activemq/trunk/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/disk/journal/DataFile.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/disk/journal/DataFile.java?rev=1415725&r1=1415724&r2=1415725&view=diff
==============================================================================
--- activemq/trunk/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/disk/journal/DataFile.java
(original)
+++ activemq/trunk/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/disk/journal/DataFile.java
Fri Nov 30 16:15:57 2012
@@ -20,14 +20,14 @@ import java.io.File;
 import java.io.IOException;
 import java.io.RandomAccessFile;
 
-import org.apache.activemq.util.IOHelper;
 import org.apache.activemq.store.kahadb.disk.util.LinkedNode;
 import org.apache.activemq.store.kahadb.disk.util.SequenceSet;
+import org.apache.activemq.util.IOHelper;
 
 /**
  * DataFile
- * 
- * 
+ *
+ *
  */
 public class DataFile extends LinkedNode<DataFile> implements Comparable<DataFile>
{
 
@@ -41,7 +41,7 @@ public class DataFile extends LinkedNode
         this.dataFileId = Integer.valueOf(number);
         length = (int)(file.exists() ? file.length() : 0);
     }
-    
+
     public File getFile() {
         return file;
     }
@@ -62,12 +62,13 @@ public class DataFile extends LinkedNode
         length += size;
     }
 
-    public synchronized String toString() {
+    @Override
+	public synchronized String toString() {
         return file.getName() + " number = " + dataFileId + " , length = " + length;
     }
 
     public synchronized RandomAccessFile openRandomAccessFile() throws IOException {
-        return new RandomAccessFile(file, "rw");
+        return new RandomAccessFile(file.getCanonicalPath(), "rw");
     }
 
     public synchronized void closeRandomAccessFile(RandomAccessFile file) throws IOException
{
@@ -77,7 +78,7 @@ public class DataFile extends LinkedNode
     public synchronized boolean delete() throws IOException {
         return file.delete();
     }
-    
+
     public synchronized void move(File targetDirectory) throws IOException{
         IOHelper.moveFile(file,targetDirectory);
     }
@@ -85,8 +86,9 @@ public class DataFile extends LinkedNode
     public SequenceSet getCorruptedBlocks() {
         return corruptedBlocks;
     }
-    
-    public int compareTo(DataFile df) {
+
+    @Override
+	public int compareTo(DataFile df) {
         return dataFileId - df.dataFileId;
     }
 



Mime
View raw message