paul-rogers commented on a change in pull request #1910: DRILL-7393: Revisit 
Drill tests to ensure that patching is executed b…
URL: https://github.com/apache/drill/pull/1910#discussion_r352250931
 
 

 ##########
 File path: common/src/main/java/org/apache/drill/common/util/GuavaPatcher.java
 ##########
 @@ -24,154 +24,157 @@
 import java.util.stream.Collectors;
 import java.util.stream.IntStream;
 
-import javassist.CannotCompileException;
 import javassist.ClassPool;
 import javassist.CtClass;
 import javassist.CtConstructor;
 import javassist.CtMethod;
 import javassist.CtNewMethod;
-import javassist.NotFoundException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public class GuavaPatcher {
   private static final Logger logger = 
LoggerFactory.getLogger(GuavaPatcher.class);
 
-  private static boolean patched;
+  private static boolean patchingAttempted;
 
   public static synchronized void patch() {
-    if (!patched) {
-      try {
-        patchStopwatch();
-        patchCloseables();
-        patchPreconditions();
-        patched = true;
-      } catch (Throwable e) {
-        logger.warn("Unable to patch Guava classes.", e);
-      }
+    if (!patchingAttempted) {
+      patchingAttempted = true;
 
 Review comment:
   This version no longer has a try/catch block. Is the idea that, if patching 
fails, the test should fail? If this particular test fails, we've marked 
patching as attempted and we won't try again. This means that future tests that 
needed the patching will mysteriously fail.
   
   Should we, instead, simply do a `System.exit(1)` if patching fails to shut 
down the tests? Or, print a warning to stderr that subsequent tests may fail?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to