From 1acf5a742436d2e8460a880c11dd4946d2ca3555 Mon Sep 17 00:00:00 2001 From: Hyunjin Choi Date: Tue, 4 Feb 2020 22:45:52 +0900 Subject: [PATCH] Use dedicated catch block for ScriptException Closes gh-24383 --- .../jdbc/datasource/init/DatabasePopulatorUtils.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/init/DatabasePopulatorUtils.java b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/init/DatabasePopulatorUtils.java index 534df4a082..b8de5191ae 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/init/DatabasePopulatorUtils.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/init/DatabasePopulatorUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 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. @@ -52,10 +52,10 @@ public abstract class DatabasePopulatorUtils { DataSourceUtils.releaseConnection(connection, dataSource); } } + catch (ScriptException ex){ + throw ex; + } catch (Throwable ex) { - if (ex instanceof ScriptException) { - throw (ScriptException) ex; - } throw new UncategorizedScriptException("Failed to execute database script", ex); } }