You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by li...@apache.org on 2023/12/11 17:57:18 UTC

(arrow) branch main updated: GH-39170: [Java] Improve error message explaining why TestTls might fail (#39171)

This is an automated email from the ASF dual-hosted git repository.

lidavidm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/main by this push:
     new 7ba022863c GH-39170: [Java] Improve error message explaining why TestTls might fail (#39171)
7ba022863c is described below

commit 7ba022863c75a7d04f16d21b65a66250ac74dbfa
Author: JB Onofré <jb...@apache.org>
AuthorDate: Mon Dec 11 18:57:11 2023 +0100

    GH-39170: [Java] Improve error message explaining why TestTls might fail (#39171)
    
    
    
    ### Rationale for this change
    
    ### What changes are included in this PR?
    
    ### Are these changes tested?
    
    ### Are there any user-facing changes?
    
    * Closes: #39170
    
    Authored-by: JB Onofré <jb...@apache.org>
    Signed-off-by: David Li <li...@gmail.com>
---
 .../src/test/java/org/apache/arrow/flight/FlightTestUtil.java      | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/java/flight/flight-core/src/test/java/org/apache/arrow/flight/FlightTestUtil.java b/java/flight/flight-core/src/test/java/org/apache/arrow/flight/FlightTestUtil.java
index 25d59d99ad..64f70856a3 100644
--- a/java/flight/flight-core/src/test/java/org/apache/arrow/flight/FlightTestUtil.java
+++ b/java/flight/flight-core/src/test/java/org/apache/arrow/flight/FlightTestUtil.java
@@ -19,6 +19,7 @@ package org.apache.arrow.flight;
 
 import java.io.File;
 import java.lang.reflect.InvocationTargetException;
+import java.nio.file.Files;
 import java.nio.file.Path;
 import java.util.Arrays;
 import java.util.List;
@@ -47,7 +48,11 @@ public class FlightTestUtil {
 
   static List<CertKeyPair> exampleTlsCerts() {
     final Path root = getFlightTestDataRoot();
-    return Arrays.asList(new CertKeyPair(root.resolve("cert0.pem").toFile(), root.resolve("cert0.pkcs1").toFile()),
+    final Path cert0Pem = root.resolve("cert0.pem");
+    if (!Files.exists(cert0Pem)) {
+      throw new RuntimeException(cert0Pem + " doesn't exist. Make sure submodules are initialized (see https://arrow.apache.org/docs/dev/developers/java/building.html#building)");
+    }
+    return Arrays.asList(new CertKeyPair(cert0Pem.toFile(), root.resolve("cert0.pkcs1").toFile()),
         new CertKeyPair(root.resolve("cert1.pem").toFile(), root.resolve("cert1.pkcs1").toFile()));
   }