flink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmetz...@apache.org
Subject [05/11] git commit: Fix class loader when extracting lambdas
Date Fri, 17 Oct 2014 14:52:32 GMT
Fix class loader when extracting lambdas


Project: http://git-wip-us.apache.org/repos/asf/incubator-flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-flink/commit/460271c0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-flink/tree/460271c0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-flink/diff/460271c0

Branch: refs/heads/release-0.7
Commit: 460271c0e4ee0223dd793e18e660b567674aefa0
Parents: 83cad28
Author: Stephan Ewen <sewen@apache.org>
Authored: Tue Oct 14 14:37:42 2014 +0200
Committer: Robert Metzger <rmetzger@apache.org>
Committed: Fri Oct 17 16:48:55 2014 +0200

----------------------------------------------------------------------
 .../flink/api/common/functions/util/FunctionUtils.java    | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/460271c0/flink-core/src/main/java/org/apache/flink/api/common/functions/util/FunctionUtils.java
----------------------------------------------------------------------
diff --git a/flink-core/src/main/java/org/apache/flink/api/common/functions/util/FunctionUtils.java
b/flink-core/src/main/java/org/apache/flink/api/common/functions/util/FunctionUtils.java
index 8ab2184..2486074 100644
--- a/flink-core/src/main/java/org/apache/flink/api/common/functions/util/FunctionUtils.java
+++ b/flink-core/src/main/java/org/apache/flink/api/common/functions/util/FunctionUtils.java
@@ -99,11 +99,11 @@ public class FunctionUtils {
 			String className = (String) implClassMethod.invoke(serializedLambda);
 			String methodName = (String) implMethodNameMethod.invoke(serializedLambda);
 
-			Class<?> implClass = Class.forName(className.replace('/', '.'));
+			Class<?> implClass = Class.forName(className.replace('/', '.'), true, Thread.currentThread().getContextClassLoader());
 
 			Method[] methods = implClass.getDeclaredMethods();
 			Method parameterizedMethod = null;
-			for(Method method : methods) {
+			for (Method method : methods) {
 				if(method.getName().equals(methodName)) {
 					if(parameterizedMethod != null) {
 						// It is very unlikely that a class contains multiple e.g. "lambda$2()" but its possible
@@ -115,13 +115,13 @@ public class FunctionUtils {
 					}
 				}
 			}
-			if(parameterizedMethod == null) {
+			if (parameterizedMethod == null) {
 				throw new Exception("No lambda method found.");
 			}
 			return parameterizedMethod;
 		}
-		catch(Exception e) {
-			throw new RuntimeException("Could not extract lambda method out of function.", e);
+		catch (Exception e) {
+			throw new RuntimeException("Could not extract lambda method out of function: " + e.getClass().getSimpleName()
+ " - " + e.getMessage(), e);
 		}
 	}
 }


Mime
View raw message