You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by rm...@apache.org on 2014/06/21 14:57:37 UTC
git commit: Fixes a bug where
Thread.currentThread().getContextClassLoader() does not return the user code
class loader within object deserialization.
Repository: incubator-flink
Updated Branches:
refs/heads/master ff69b1bb2 -> 7b6b5a2e0
Fixes a bug where Thread.currentThread().getContextClassLoader() does not return the user code class loader within object deserialization.
Project: http://git-wip-us.apache.org/repos/asf/incubator-flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-flink/commit/7b6b5a2e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-flink/tree/7b6b5a2e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-flink/diff/7b6b5a2e
Branch: refs/heads/master
Commit: 7b6b5a2e019866bf8fdd993775eab410e22f0f5d
Parents: ff69b1b
Author: twalthr <in...@twalthr.com>
Authored: Fri Jun 20 15:19:43 2014 +0200
Committer: Robert Metzger <rm...@apache.org>
Committed: Sat Jun 21 13:28:35 2014 +0200
----------------------------------------------------------------------
.../hadoopcompatibility/mapreduce/example/WordCount.java | 2 ++
.../src/main/java/eu/stratosphere/util/InstantiationUtil.java | 3 +++
2 files changed, 5 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/7b6b5a2e/stratosphere-addons/hadoop-compatibility/src/main/java/eu/stratosphere/hadoopcompatibility/mapreduce/example/WordCount.java
----------------------------------------------------------------------
diff --git a/stratosphere-addons/hadoop-compatibility/src/main/java/eu/stratosphere/hadoopcompatibility/mapreduce/example/WordCount.java b/stratosphere-addons/hadoop-compatibility/src/main/java/eu/stratosphere/hadoopcompatibility/mapreduce/example/WordCount.java
index b7a37c7..70d8ce8 100644
--- a/stratosphere-addons/hadoop-compatibility/src/main/java/eu/stratosphere/hadoopcompatibility/mapreduce/example/WordCount.java
+++ b/stratosphere-addons/hadoop-compatibility/src/main/java/eu/stratosphere/hadoopcompatibility/mapreduce/example/WordCount.java
@@ -72,6 +72,8 @@ public class WordCount {
// Set up Hadoop Output Format
HadoopOutputFormat<Text, IntWritable> hadoopOutputFormat = new HadoopOutputFormat<Text, IntWritable>(new TextOutputFormat<Text, IntWritable>(), job);
hadoopOutputFormat.getConfiguration().set("mapreduce.output.textoutputformat.separator", " ");
+ hadoopOutputFormat.getConfiguration().set("mapred.textoutputformat.separator", " "); // set the value for both, since this test
+ // is being executed with both types (hadoop1 and hadoop2 profile)
TextOutputFormat.setOutputPath(job, new Path(outputPath));
// Output & Execute
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/7b6b5a2e/stratosphere-core/src/main/java/eu/stratosphere/util/InstantiationUtil.java
----------------------------------------------------------------------
diff --git a/stratosphere-core/src/main/java/eu/stratosphere/util/InstantiationUtil.java b/stratosphere-core/src/main/java/eu/stratosphere/util/InstantiationUtil.java
index 11c6ac1..174c7c6 100644
--- a/stratosphere-core/src/main/java/eu/stratosphere/util/InstantiationUtil.java
+++ b/stratosphere-core/src/main/java/eu/stratosphere/util/InstantiationUtil.java
@@ -234,10 +234,13 @@ public class InstantiationUtil {
public static Object deserializeObject(byte[] bytes, ClassLoader cl) throws IOException, ClassNotFoundException {
ObjectInputStream oois = null;
+ final ClassLoader old = Thread.currentThread().getContextClassLoader();
try {
+ Thread.currentThread().setContextClassLoader(cl);
oois = new ClassLoaderObjectInputStream(new ByteArrayInputStream(bytes), cl);
return oois.readObject();
} finally {
+ Thread.currentThread().setContextClassLoader(old);
if (oois != null) {
oois.close();
}