This is an automated email from the ASF dual-hosted git repository. mblow pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/asterixdb.git
commit 7ca418c43eaf3e857ba6db8205bff43be9142741 Author: Michael Blow <[email protected]> AuthorDate: Wed Mar 24 18:49:54 2021 -0400 [NO ISSUE][TEST] On unexpected non-JSON result, throw exception with content (if any) Change-Id: Iaa2be7b877cb6ea1230c4d084438ca44ee51d86f Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/10685 Reviewed-by: Michael Blow <[email protected]> Reviewed-by: Murtadha Hubail <[email protected]> Tested-by: Michael Blow <[email protected]> Integration-Tests: Jenkins <[email protected]> --- .../java/org/apache/asterix/test/common/ResultExtractor.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/ResultExtractor.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/ResultExtractor.java index 3895ec8..5ab5b01 100644 --- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/ResultExtractor.java +++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/ResultExtractor.java @@ -28,9 +28,11 @@ import java.util.Iterator; import java.util.List; import java.util.Map; +import org.apache.asterix.common.config.GlobalConfig; import org.apache.asterix.common.exceptions.AsterixException; import org.apache.asterix.testframework.context.TestCaseContext.OutputFormat; import org.apache.commons.io.IOUtils; +import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -203,7 +205,15 @@ public class ResultExtractor { LOGGER.debug("+++++++\n" + resultStr + "\n+++++++\n"); - final ObjectNode result = OBJECT_READER.readValue(resultStr); + final ObjectNode result; + try { + result = OBJECT_READER.readValue(resultStr); + } catch (Exception e) { + // whoops, not JSON (e.g. 404) - just include the body + GlobalConfig.ASTERIX_LOGGER.log(Level.ERROR, resultStr); + throw new Exception(resultStr); + } + final boolean isJsonFormat = isJsonFormat(fmt); // if we have errors field in the results, we will always return it
