hadoop-mapreduce-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acmur...@apache.org
Subject svn commit: r1170289 - in /hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/src/contrib: eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/ eclipse-plugin/src/java/org/apache/hadoop/eclipse/servers/ streaming/src/java/org/apache/hadoo...
Date Tue, 13 Sep 2011 18:34:33 GMT
Author: acmurthy
Date: Tue Sep 13 18:34:32 2011
New Revision: 1170289

URL: http://svn.apache.org/viewvc?rev=1170289&view=rev
Log:
Merge -r 1170287:1170288 from trunk to branch-0.23 to fix MAPREDUCE-2549.

Modified:
    hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopServer.java
    hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/servers/RunOnHadoopWizard.java
    hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/src/contrib/streaming/src/java/org/apache/hadoop/streaming/Environment.java

Modified: hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopServer.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopServer.java?rev=1170289&r1=1170288&r2=1170289&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopServer.java
(original)
+++ hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopServer.java
Tue Sep 13 18:34:32 2011
@@ -36,6 +36,7 @@ import javax.xml.parsers.ParserConfigura
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.eclipse.Activator;
 import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.io.IOUtils;
 import org.apache.hadoop.mapred.JobClient;
 import org.apache.hadoop.mapred.JobConf;
 import org.apache.hadoop.mapred.JobID;
@@ -420,8 +421,14 @@ public class HadoopServer {
    */
   public void storeSettingsToFile(File file) throws IOException {
     FileOutputStream fos = new FileOutputStream(file);
-    this.conf.writeXml(fos);
-    fos.close();
+    try {
+      this.conf.writeXml(fos);
+      fos.close();
+      fos = null;
+    } finally {
+      IOUtils.closeStream(fos);
+    }
+
   }
 
   /* @inheritDoc */

Modified: hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/servers/RunOnHadoopWizard.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/servers/RunOnHadoopWizard.java?rev=1170289&r1=1170288&r2=1170289&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/servers/RunOnHadoopWizard.java
(original)
+++ hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/servers/RunOnHadoopWizard.java
Tue Sep 13 18:34:32 2011
@@ -28,6 +28,7 @@ import org.apache.hadoop.eclipse.Activat
 import org.apache.hadoop.eclipse.ErrorMessageDialog;
 import org.apache.hadoop.eclipse.server.HadoopServer;
 import org.apache.hadoop.eclipse.server.JarModule;
+import org.apache.hadoop.io.IOUtils;
 import org.apache.hadoop.mapred.JobConf;
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.runtime.CoreException;
@@ -164,8 +165,13 @@ public class RunOnHadoopWizard extends W
       // confDir);
       File confFile = new File(confDir, "core-site.xml");
       FileOutputStream fos = new FileOutputStream(confFile);
-      conf.writeXml(fos);
-      fos.close();
+      try {
+        conf.writeXml(fos);
+        fos.close();
+        fos = null;
+      } finally {
+        IOUtils.closeStream(fos);
+      }
 
     } catch (IOException ioe) {
       ioe.printStackTrace();

Modified: hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/src/contrib/streaming/src/java/org/apache/hadoop/streaming/Environment.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/src/contrib/streaming/src/java/org/apache/hadoop/streaming/Environment.java?rev=1170289&r1=1170288&r2=1170289&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/src/contrib/streaming/src/java/org/apache/hadoop/streaming/Environment.java
(original)
+++ hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/src/contrib/streaming/src/java/org/apache/hadoop/streaming/Environment.java
Tue Sep 13 18:34:32 2011
@@ -23,6 +23,7 @@ import java.net.InetAddress;
 import java.util.*;
 
 import org.apache.hadoop.classification.InterfaceAudience;
+import org.apache.hadoop.io.IOUtils;
 
 /**
  * This is a class used to get the current environment
@@ -62,17 +63,24 @@ public class Environment extends Propert
 
     Process pid = Runtime.getRuntime().exec(command);
     BufferedReader in = new BufferedReader(new InputStreamReader(pid.getInputStream()));
-    while (true) {
-      String line = in.readLine();
-      if (line == null) break;
-      int p = line.indexOf("=");
-      if (p != -1) {
-        String name = line.substring(0, p);
-        String value = line.substring(p + 1);
-        setProperty(name, value);
+    try {
+      while (true) {
+        String line = in.readLine();
+        if (line == null)
+          break;
+        int p = line.indexOf("=");
+        if (p != -1) {
+          String name = line.substring(0, p);
+          String value = line.substring(p + 1);
+          setProperty(name, value);
+        }
       }
+      in.close();
+      in = null;
+    } finally {
+      IOUtils.closeStream(in);
     }
-    in.close();
+   
     try {
       pid.waitFor();
     } catch (InterruptedException e) {



Mime
View raw message