Skip to content

Commit ccc58cb

Browse files
committed
code polish
1 parent c1a6c31 commit ccc58cb

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/main/java/org/apache/ibatis/executor/resultset/NestedResultSetHandler.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,13 +164,13 @@ private boolean applyNestedResultMappings(ResultSet rs, ResultMap resultMap, Met
164164
targetMetaObject.add(rowValue);
165165
} else {
166166
if (!parentIsNew && !isAncestor) {
167-
throw new ExecutorException("Trying to set a 1 to 1 child element twice for '" + resultMapping.getProperty() + "'. Check your id properties.");
167+
throw new ExecutorException("Trying to set a 1 to 1 child element twice for '" + resultMapping.getProperty() + "'. Check your id properties.");
168168
}
169169
metaObject.setValue(resultMapping.getProperty(), rowValue);
170170
}
171171
foundValues = true;
172172
}
173-
} catch (Exception e) {
173+
} catch (SQLException e) {
174174
throw new ExecutorException("Error getting nested result map values for '" + resultMapping.getProperty() + "'. Cause: " + e, e);
175175
}
176176
}
@@ -243,9 +243,14 @@ private CacheKey createAbsoluteKey(ResultMap resultMap, ResultSet rs, String col
243243
return cacheKey;
244244
}
245245

246-
private CacheKey getCombinedKey(CacheKey rowKey, CacheKey parentRowKey) throws CloneNotSupportedException {
246+
private CacheKey getCombinedKey(CacheKey rowKey, CacheKey parentRowKey) {
247247
if (rowKey.getUpdateCount() > 1 && parentRowKey.getUpdateCount() > 1) {
248-
CacheKey combinedKey = rowKey.clone();
248+
CacheKey combinedKey;
249+
try {
250+
combinedKey = rowKey.clone();
251+
} catch (CloneNotSupportedException e) {
252+
throw new ExecutorException("Error cloning cache key. Cause: " + e, e);
253+
}
249254
combinedKey.update(parentRowKey);
250255
return combinedKey;
251256
}

0 commit comments

Comments
 (0)