diff --git a/src/tap/db/JDBCConnection.java b/src/tap/db/JDBCConnection.java index bd2d5190a92c80c9584674c01dcc4e49c4be9e2e..9ce843df20171d27ef1a3a62c1fb92221efaced9 100644 --- a/src/tap/db/JDBCConnection.java +++ b/src/tap/db/JDBCConnection.java @@ -743,9 +743,14 @@ public class JDBCConnection implements DBConnection { if (ex instanceof DBCancelledException) throw (DBCancelledException)ex; // Otherwise propagate the exception with an appropriate error message: - else if (ex instanceof SQLException) - throw new DBException("Unexpected error while executing a SQL query: " + ex.getMessage(), ex); - else if (ex instanceof TranslationException) + else if (ex instanceof SQLException){ + /* ...except if the query has been aborted: + * then, it is normal to receive an SQLException: */ + if (isCancelled()) + throw new DBCancelledException(); + else + throw new DBException("Unexpected error while executing a SQL query: " + ex.getMessage(), ex); + }else if (ex instanceof TranslationException) throw new DBException("Unexpected error while translating ADQL into SQL: " + ex.getMessage(), ex); else if (ex instanceof DataReadException) throw new DBException("Impossible to read the query result, because: " + ex.getMessage(), ex);