Skip to content

Commit 619fa2b

Browse files
committed
fix: Simplify exception truncation
1 parent e80b0a9 commit 619fa2b

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/main/java/com/salesforce/datacloud/jdbc/exception/QueryExceptionHandler.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,9 @@ public class QueryExceptionHandler {
3333
private static final int MAX_QUERY_LENGTH_IN_EXCEPTION = 16 * 1024;
3434

3535
public static DataCloudJDBCException createQueryException(String query, Exception e) {
36-
String exceptionQuery = query;
37-
if (exceptionQuery.length() > MAX_QUERY_LENGTH_IN_EXCEPTION) {
38-
exceptionQuery = exceptionQuery.substring(0, MAX_QUERY_LENGTH_IN_EXCEPTION) + "<truncated>";
39-
}
36+
String exceptionQuery = query.length() > MAX_QUERY_LENGTH_IN_EXCEPTION
37+
? query.substring(0, MAX_QUERY_LENGTH_IN_EXCEPTION) + "<truncated>"
38+
: query;
4039
return QueryExceptionHandler.createException("Failed to execute query: " + exceptionQuery, e);
4140
}
4241

0 commit comments

Comments
 (0)