diff options
author | cparsons <cparsons@google.com> | 2018-04-18 09:39:02 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-04-18 09:40:44 -0700 |
commit | 4803293f39b82ca2ed07c123e30c3f808f16e1a8 (patch) | |
tree | 728b8f85fea3a95bd5269a5673b06a19c9de36e0 /src/main/java/com/google/devtools/build/lib/syntax/FuncallExpression.java | |
parent | 77a5be49a995ab413401f33dfc1523b50c1299c5 (diff) |
Handle InterruptedException thrown from @SkylarkCallable methods appropriately.
RELNOTES: None.
PiperOrigin-RevId: 193370435
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.java | 8 |
1 files changed, 6 insertions, 2 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 1928fcec7f..dba8ffc92c 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; @@ -353,13 +354,14 @@ public final class FuncallExpression extends Expression { * @throws EvalException if there was an issue evaluating the method */ public static Object invokeStructField( - MethodDescriptor methodDescriptor, String fieldName, Object obj) throws EvalException { + MethodDescriptor methodDescriptor, String fieldName, Object obj) + throws EvalException, InterruptedException { Preconditions.checkArgument(methodDescriptor.getAnnotation().structField()); return callMethod(methodDescriptor, fieldName, obj, new Object[0], Location.BUILTIN, null); } static Object callMethod(MethodDescriptor methodDescriptor, String methodName, Object obj, - Object[] args, Location loc, Environment env) throws EvalException { + Object[] args, Location loc, Environment env) throws EvalException, InterruptedException { try { Method method = methodDescriptor.getMethod(); if (obj == null && !Modifier.isStatic(method.getModifiers())) { @@ -401,6 +403,8 @@ public final class FuncallExpression extends Expression { if (e.getCause() instanceof FuncallException) { throw new EvalException(loc, e.getCause().getMessage()); } else if (e.getCause() != null) { + Throwables.throwIfInstanceOf(e.getCause(), InterruptedException.class); + throw new EvalExceptionWithJavaCause(loc, e.getCause()); } else { // This is unlikely to happen |