simplify error message
Provide an exception class only if no message is available and provide only
the simple name of the class, if it is given.
Change-Id: I09c8ef4e3b594801304e2168508b780a443ab6a1
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1181
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Yingyi Bu <buyingyi@gmail.com>
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/QueryServiceServlet.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/QueryServiceServlet.java
index 3b69dd1..132737b 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/QueryServiceServlet.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/QueryServiceServlet.java
@@ -49,8 +49,8 @@
import org.apache.asterix.lang.common.base.Statement;
import org.apache.asterix.metadata.MetadataManager;
import org.apache.asterix.translator.IStatementExecutor;
-import org.apache.asterix.translator.IStatementExecutorFactory;
import org.apache.asterix.translator.IStatementExecutor.Stats;
+import org.apache.asterix.translator.IStatementExecutorFactory;
import org.apache.commons.io.IOUtils;
import org.apache.hyracks.algebricks.core.algebra.prettyprint.AlgebricksAppendable;
import org.apache.hyracks.api.client.IHyracksClientConnection;
@@ -341,8 +341,8 @@
pw.print("\": [{ \n");
printField(pw, ErrorField.CODE.str(), "1");
final String msg = rootCause.getMessage();
- printField(pw, ErrorField.MSG.str(),
- JSONUtil.escape(rootCause.getClass().getName() + ": " + (msg != null ? msg : "")), addStack);
+ printField(pw, ErrorField.MSG.str(), JSONUtil.escape(msg != null ? msg : rootCause.getClass().getSimpleName()),
+ addStack);
if (addStack) {
StringWriter sw = new StringWriter();
PrintWriter stackWriter = new PrintWriter(sw);
@@ -424,8 +424,8 @@
IParser parser = compilationProvider.getParserFactory().createParser(query);
List<Statement> aqlStatements = parser.parse();
MetadataManager.INSTANCE.init();
- IStatementExecutor translator =
- statementExecutorFactory.create(aqlStatements, sessionConfig, compilationProvider);
+ IStatementExecutor translator = statementExecutorFactory.create(aqlStatements, sessionConfig,
+ compilationProvider);
execStart = System.nanoTime();
translator.compileAndExecute(hcc, hds, QueryTranslator.ResultDelivery.SYNC, stats);
execEnd = System.nanoTime();