mirror of
https://github.com/moparisthebest/JdbcMapper
synced 2024-11-24 01:52:22 -05:00
SimpleSQLChecker tighten up exception handling
This commit is contained in:
parent
7b1b83fddd
commit
94d3ba89e0
@ -187,7 +187,7 @@ public class JdbcMapperProcessor extends AbstractProcessor {
|
||||
(mapper.databaseType() == defaultDatabaseType ? defaultArrayStringTypeName : mapper.databaseType().arrayStringTypeName);
|
||||
}
|
||||
final ArrayInList arrayInList;
|
||||
if(sqlChecker != null) {
|
||||
if(sqlCheckerClass != null) {
|
||||
switch(databaseType) {
|
||||
case ORACLE:
|
||||
arrayInList = new OracleArrayInList(arrayNumberTypeName, arrayStringTypeName);
|
||||
@ -1230,6 +1230,8 @@ public class JdbcMapperProcessor extends AbstractProcessor {
|
||||
}
|
||||
|
||||
public static String toString(final Throwable e) {
|
||||
if (e == null)
|
||||
return "exception object was null";
|
||||
StringWriter sw = null;
|
||||
PrintWriter pw = null;
|
||||
try {
|
||||
|
@ -83,9 +83,9 @@ public class SimpleSQLChecker implements SQLChecker {
|
||||
}
|
||||
|
||||
public void handleException(final Messager messager, final Exception e, final TypeElement classElement, final ExecutableElement method) {
|
||||
if (e.getMessage().startsWith("ORA-02291: integrity constraint"))
|
||||
if (e != null && e.getMessage() != null && e.getMessage().startsWith("ORA-02291: integrity constraint"))
|
||||
return; // since we make up values and rollback we can ignore this, it means SQL is correct at least
|
||||
getMessager().printMessage(Diagnostic.Kind.ERROR, e.getMessage(), method);
|
||||
messager.printMessage(Diagnostic.Kind.ERROR, e == null || e.getMessage() == null ? JdbcMapperProcessor.toString(e) : e.getMessage(), method);
|
||||
}
|
||||
|
||||
public Collection<Object> getFakeBindParams(final List<VariableElement> bindParams, final Connection conn, final ArrayInList arrayInList) throws SQLException {
|
||||
|
Loading…
Reference in New Issue
Block a user