aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/syntax/FuncallExpression.java
diff options
context:
space:
mode:
authorGravatar Benjamin Peterson <bp@benjamin.pe>2018-08-08 10:03:22 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-08-08 10:05:09 -0700
commitbf1db78d75ac6d2fe40742c36f79341859274f50 (patch)
treeac872853ae2d07928914d63adad59fadc9406a1e /src/main/java/com/google/devtools/build/lib/syntax/FuncallExpression.java
parent25f112e0eba147f14ac51736c41ced3d6b284b57 (diff)
Don't convert InterruptException to EvalException in struct field call expressions.
This is probably only a theoretical problem, since a blocking struct field is probably a very bad idea. Closes #5132. Change-Id: Ie84a78ab4d9ce215f2806ac49bf8911de6959930 PiperOrigin-RevId: 207902766
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/syntax/FuncallExpression.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/syntax/FuncallExpression.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/FuncallExpression.java b/src/main/java/com/google/devtools/build/lib/syntax/FuncallExpression.java
index 44e6a67ae9..03695abaa2 100644
--- a/src/main/java/com/google/devtools/build/lib/syntax/FuncallExpression.java
+++ b/src/main/java/com/google/devtools/build/lib/syntax/FuncallExpression.java
@@ -17,6 +17,7 @@ package com.google.devtools.build.lib.syntax;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Joiner;
import com.google.common.base.Preconditions;
+import com.google.common.base.Throwables;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
@@ -781,20 +782,23 @@ public final class FuncallExpression extends Expression {
call.findJavaMethod(objClass, method, positionalArgs, keyWordArgs, env);
if (javaMethod.first.isStructField()) {
// Not a method but a callable attribute
+ Object func;
try {
- return callFunction(javaMethod.first.invoke(obj), env);
+ func = javaMethod.first.invoke(obj);
} catch (IllegalAccessException e) {
throw new EvalException(getLocation(), "method invocation failed: " + e);
} catch (InvocationTargetException e) {
if (e.getCause() instanceof FuncallException) {
throw new EvalException(getLocation(), e.getCause().getMessage());
} else if (e.getCause() != null) {
+ Throwables.throwIfInstanceOf(e.getCause(), InterruptedException.class);
throw new EvalExceptionWithJavaCause(getLocation(), e.getCause());
} else {
// This is unlikely to happen
throw new EvalException(getLocation(), "method invocation failed: " + e);
}
}
+ return callFunction(func, env);
}
return javaMethod.first.call(obj, javaMethod.second.toArray(), location, env);
}