hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From na...@apache.org
Subject svn commit: r1073762 - in /hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec: ScriptOperator.java Utilities.java
Date Wed, 23 Feb 2011 15:00:49 GMT
Author: namit
Date: Wed Feb 23 15:00:48 2011
New Revision: 1073762

URL: http://svn.apache.org/viewvc?rev=1073762&view=rev
Log:
HIVE-1974 In error scenario some opened streams may not closed in ScriptOperator.java,
Utilities.java (Chinna Rao Lalam via namit)


Modified:
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/ScriptOperator.java
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/Utilities.java

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/ScriptOperator.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/ScriptOperator.java?rev=1073762&r1=1073761&r2=1073762&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/ScriptOperator.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/ScriptOperator.java Wed Feb 23 15:00:48
2011
@@ -574,11 +574,18 @@ public class ScriptOperator extends Oper
           if (in != null) {
             in.close();
           }
-          proc.close();
         } catch (Exception e) {
           LOG.warn(name + ": error in closing ..");
           LOG.warn(StringUtils.stringifyException(e));
         }
+        try
+        {
+          if (null != proc) {
+            proc.close();
+          }
+        }catch (Exception e) {
+          LOG.warn(": error in closing .."+StringUtils.stringifyException(e));
+        }
       }
     }
   }

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/Utilities.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/Utilities.java?rev=1073762&r1=1073761&r2=1073762&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/Utilities.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/Utilities.java Wed Feb 23 15:00:48
2011
@@ -386,14 +386,20 @@ public final class Utilities {
    * Serialize a single Task.
    */
   public static void serializeTasks(Task<? extends Serializable> t, OutputStream out)
{
-    XMLEncoder e = new XMLEncoder(out);
-    // workaround for java 1.5
-    e.setPersistenceDelegate(ExpressionTypes.class, new EnumDelegate());
-    e.setPersistenceDelegate(GroupByDesc.Mode.class, new EnumDelegate());
-    e.setPersistenceDelegate(Operator.ProgressCounter.class, new EnumDelegate());
-
-    e.writeObject(t);
-    e.close();
+    XMLEncoder e = null;
+    try {
+      e = new XMLEncoder(out);
+      // workaround for java 1.5
+      e.setPersistenceDelegate(ExpressionTypes.class, new EnumDelegate());
+      e.setPersistenceDelegate(GroupByDesc.Mode.class, new EnumDelegate());
+      e.setPersistenceDelegate(Operator.ProgressCounter.class, new EnumDelegate());
+
+      e.writeObject(t);
+    }finally {
+      if(null != e){
+        e.close();
+      }
+    }
   }
 
   public static class CollectionPersistenceDelegate extends DefaultPersistenceDelegate {



Mime
View raw message