OPENJPA-2745: Clean up try-catch implementation for DB2Dictionary

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@1837662 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Will Dazey 2018-08-08 16:59:04 +00:00
parent 4477ace6fd
commit c79c09ac39

View File

@ -1024,30 +1024,22 @@ public class DB2Dictionary
return (byte[]) rs.getObject(column); return (byte[]) rs.getObject(column);
} }
// At this point we don't have any idea if the DB2 column was defined as int type = rs.getMetaData().getColumnType(column);
// a blob or if it was defined as CHAR for BIT DATA. switch (type) {
// First try as a blob, if that doesn't work, then try as CHAR for BIT DATA case Types.BLOB:
// If that doesn't work, then go ahead and throw the first exception Blob blob = getBlob(rs, column);
try { if (blob == null) {
Blob blob = getBlob(rs, column); return null;
if (blob == null) { }
return null;
}
int length = (int) blob.length(); int length = (int) blob.length();
if (length == 0) { if (length == 0) {
return null; return null;
} }
return blob.getBytes(1, length);
return blob.getBytes(1, length); case Types.BINARY:
} default:
catch (SQLException e) {
try {
return rs.getBytes(column); return rs.getBytes(column);
}
catch (SQLException e2) {
throw e;
}
} }
} }