Browse Source

HADOOP-3391. Fix a findbugs warning introduced by HADOOP-3248 (rangadi)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/trunk@656491 13f79535-47bb-0310-9956-ffa450edef68
Raghu Angadi 17 years ago
parent
commit
f462444e10
2 changed files with 5 additions and 4 deletions
  1. 2 0
      CHANGES.txt
  2. 3 4
      src/java/org/apache/hadoop/dfs/FSImage.java

+ 2 - 0
CHANGES.txt

@@ -250,6 +250,8 @@ Trunk (unreleased changes)
     HADOOP-3203. Fixes TaskTracker::localizeJob to pass correct file sizes
     for the jarfile and the jobfile. (Amareshwari Sriramadasu via ddas)
 
+    HADOOP-3391. Fix a findbugs warning introduced by HADOOP-3248 (rangadi)
+
 Release 0.17.0 - Unreleased
 
   INCOMPATIBLE CHANGES

+ 3 - 4
src/java/org/apache/hadoop/dfs/FSImage.java

@@ -92,7 +92,6 @@ class FSImage extends Storage {
    */
   static private final FsPermission FILE_PERM = new FsPermission((short)0);
   static private final byte[] PATH_SEPARATOR = INode.string2Bytes(Path.SEPARATOR);
-  static private byte[] byteStore = null;
 
   /**
    */
@@ -843,11 +842,10 @@ class FSImage extends Storage {
       out.writeInt(namespaceID);
       out.writeInt(fsDir.rootDir.numItemsInTree() - 1);
       out.writeLong(fsNamesys.getGenerationStamp());
-      byteStore = new byte[4*FSConstants.MAX_PATH_LENGTH];
+      byte[] byteStore = new byte[4*FSConstants.MAX_PATH_LENGTH];
       ByteBuffer strbuf = ByteBuffer.wrap(byteStore);
       saveImage(strbuf, 0, fsDir.rootDir, out);
       fsNamesys.saveFilesUnderConstruction(out);
-      byteStore = null;
       strbuf = null;
     } finally {
       out.close();
@@ -941,7 +939,8 @@ class FSImage extends Storage {
       parentPrefix.put(PATH_SEPARATOR).put(child.getLocalNameBytes());
       newPrefixLength = parentPrefix.position();
       out.writeShort(newPrefixLength);
-      out.write(byteStore, 0, newPrefixLength);
+      out.write(parentPrefix.array(), parentPrefix.arrayOffset(),
+                newPrefixLength);
       if (!child.isDirectory()) {  // write file inode
         INodeFile fileINode = (INodeFile)child;
         out.writeShort(fileINode.getReplication());