hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject svn commit: r546261 - in /lucene/hadoop/trunk: ./ src/java/org/apache/hadoop/dfs/ src/java/org/apache/hadoop/fs/ src/java/org/apache/hadoop/util/ src/webapps/datanode/
Date Mon, 11 Jun 2007 20:24:59 GMT
Author: cutting
Date: Mon Jun 11 13:24:58 2007
New Revision: 546261

URL: http://svn.apache.org/viewvc?view=rev&rev=546261
Log:
HADOOP-1392.  Fix 'correctness' bugs identified by FindBugs in fs and dfs packages.  Contributed
by Raghu.

Modified:
    lucene/hadoop/trunk/CHANGES.txt
    lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/FSImage.java
    lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/FSNamesystem.java
    lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/NamenodeFsck.java
    lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/FileSystem.java
    lucene/hadoop/trunk/src/java/org/apache/hadoop/util/CopyFiles.java
    lucene/hadoop/trunk/src/webapps/datanode/browseBlock.jsp

Modified: lucene/hadoop/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/CHANGES.txt?view=diff&rev=546261&r1=546260&r2=546261
==============================================================================
--- lucene/hadoop/trunk/CHANGES.txt (original)
+++ lucene/hadoop/trunk/CHANGES.txt Mon Jun 11 13:24:58 2007
@@ -84,6 +84,9 @@
  27. HADOOP-1414.  Fix a number of issues identified by FindBugs as
      "Bad Practice".  (Dhruba Borthakur via cutting)
 
+ 28. HADOOP-1392.  Fix "correctness" bugs reported by FindBugs in
+     fs and dfs packages.  (Raghu Angadi via cutting)
+
 
 Release 0.13.0 - 2007-06-08
 

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/FSImage.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/FSImage.java?view=diff&rev=546261&r1=546260&r2=546261
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/FSImage.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/FSImage.java Mon Jun 11 13:24:58 2007
@@ -583,7 +583,7 @@
       if (checkpointTime <= 0L)
         needToSave |= true;
       // set finalized flag
-      isUpgradeFinalized &= !sd.getPreviousDir().exists();
+      isUpgradeFinalized = isUpgradeFinalized && !sd.getPreviousDir().exists();
     }
     assert latestSD != null : "Latest storage directory was not determined.";
 

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/FSNamesystem.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/FSNamesystem.java?view=diff&rev=546261&r1=546260&r2=546261
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/FSNamesystem.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/FSNamesystem.java Mon Jun 11 13:24:58
2007
@@ -842,11 +842,16 @@
       throw new SafeModeException("Cannot complete file " + src, safeMode);
     FileUnderConstruction pendingFile = pendingCreates.get(src);
 
-    if (dir.getFileBlocks(src.toString()) != null || pendingFile == null) {
+    Block[] fileBlocks =  dir.getFileBlocks(src.toString());
+    if (fileBlocks!= null || pendingFile == null) {    
       NameNode.stateChangeLog.warn("DIR* NameSystem.completeFile: "
                                    + "failed to complete " + src
-                                    + " because dir.getFile()==" + dir.getFileBlocks(src.toString())

-                                   + " and " + pendingFile);
+                                   + " because dir.getFileBlocks() is " + 
+                                   ((fileBlocks == null) ? "null":"non-null") + 
+                                   " and pendingFile is " + 
+                                   ((pendingFile == null) ? "null" : 
+                                     ("from " + pendingFile.getClientMachine()))
+                                  );                      
       return OPERATION_FAILED;
     } else if (!checkFileProgress(pendingFile, true)) {
       return STILL_WAITING;

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/NamenodeFsck.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/NamenodeFsck.java?view=diff&rev=546261&r1=546260&r2=546261
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/NamenodeFsck.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/NamenodeFsck.java Mon Jun 11 13:24:58
2007
@@ -420,7 +420,7 @@
     }
     if (chosenNode == null) {
       do  {
-        chosenNode = nodes[Math.abs(r.nextInt())  % nodes.length];
+        chosenNode = nodes[r.nextInt(nodes.length)];
       } while (deadNodes.contains(chosenNode));
     }
     return chosenNode;

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/FileSystem.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/FileSystem.java?view=diff&rev=546261&r1=546260&r2=546261
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/FileSystem.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/FileSystem.java Mon Jun 11 13:24:58
2007
@@ -200,10 +200,11 @@
     String thisAuthority = this.getUri().getAuthority();
     String thatAuthority = uri.getAuthority();
     if (!(this.getUri().getScheme().equals(uri.getScheme()) &&
-          (thisAuthority == null && thatAuthority == null)
-          || thisAuthority.equals(thatAuthority)))
+           (thisAuthority == thatAuthority || 
+             (thisAuthority != null && thisAuthority.equals(thatAuthority))))){
       throw new IllegalArgumentException("Wrong FS: "+path+
                                          ", expected: "+this.getUri());
+    }
   }
 
   /**

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/util/CopyFiles.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/util/CopyFiles.java?view=diff&rev=546261&r1=546260&r2=546261
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/util/CopyFiles.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/util/CopyFiles.java Mon Jun 11 13:24:58
2007
@@ -298,8 +298,8 @@
       jobConf.setBoolean(readFailuresAttribute, ignoreReadFailures);
       
       Random r = new Random();
-      Path jobDirectory = new Path(jobConf.getSystemDir(), "distcp_" 
-                                   + Integer.toString(Math.abs(r.nextInt()), 36));
+      Path jobDirectory = new Path(jobConf.getSystemDir(), "distcp_"
+                                   + Integer.toString(r.nextInt(Integer.MAX_VALUE), 36));
       Path inDir = new Path(jobDirectory, "in");
       Path fakeOutDir = new Path(jobDirectory, "out");
       FileSystem fileSys = FileSystem.get(jobConf);
@@ -477,7 +477,7 @@
       FileSystem fileSystem = FileSystem.get(conf);
       Random r = new Random();
       Path jobDirectory = new Path(jobConf.getSystemDir(), "distcp_" + 
-                                   Integer.toString(Math.abs(r.nextInt()), 36));
+                                   Integer.toString(r.nextInt(Integer.MAX_VALUE), 36));
       Path jobInputDir = new Path(jobDirectory, "in");
       if (!fileSystem.mkdirs(jobInputDir)) {
         throw new IOException("Mkdirs failed to create " + jobInputDir.toString());

Modified: lucene/hadoop/trunk/src/webapps/datanode/browseBlock.jsp
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/webapps/datanode/browseBlock.jsp?view=diff&rev=546261&r1=546260&r2=546261
==============================================================================
--- lucene/hadoop/trunk/src/webapps/datanode/browseBlock.jsp (original)
+++ lucene/hadoop/trunk/src/webapps/datanode/browseBlock.jsp Mon Jun 11 13:24:58 2007
@@ -61,7 +61,7 @@
 
     String blockSizeStr = req.getParameter("blockSize"); 
     long blockSize = 0;
-    if (blockSizeStr == null && blockSizeStr.length() == 0) {
+    if (blockSizeStr == null || blockSizeStr.length() == 0) {
       out.print("Invalid input");
       return;
     } 



Mime
View raw message