Skip to content

Commit

Permalink
Unwrap SqlParameterValue for disposable value detection in cleanupPar…
Browse files Browse the repository at this point in the history
…ameters

Closes gh-22972
  • Loading branch information
jhoeller committed Jul 19, 2020
1 parent f38ab38 commit 6d524e1
Showing 1 changed file with 9 additions and 4 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -513,12 +513,17 @@ public static void cleanupParameters(Object... paramValues) {
public static void cleanupParameters(Collection<?> paramValues) {
if (paramValues != null) {
for (Object inValue : paramValues) {
if (inValue instanceof DisposableSqlTypeValue) {
((DisposableSqlTypeValue) inValue).cleanup();
// Unwrap SqlParameterValue first...
if (inValue instanceof SqlParameterValue) {
inValue = ((SqlParameterValue) inValue).getValue();
}
else if (inValue instanceof SqlValue) {
// Check for disposable value types
if (inValue instanceof SqlValue) {
((SqlValue) inValue).cleanup();
}
else if (inValue instanceof DisposableSqlTypeValue) {
((DisposableSqlTypeValue) inValue).cleanup();
}
}
}
}
Expand Down

0 comments on commit 6d524e1

Please sign in to comment.