From 91eef92098da5f3c8f2dd31bac889ab215633827 Mon Sep 17 00:00:00 2001 From: taojinlong Date: Wed, 9 Jun 2021 16:42:12 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=A4=84=E7=90=86=E8=BF=9E=E6=8E=A5?= =?UTF-8?q?=E6=B1=A0=E4=B8=BA=E7=A9=BA=E7=9A=84=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../datasource/provider/JdbcProvider.java | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/backend/src/main/java/io/dataease/datasource/provider/JdbcProvider.java b/backend/src/main/java/io/dataease/datasource/provider/JdbcProvider.java index 8055b25533..116ddba542 100644 --- a/backend/src/main/java/io/dataease/datasource/provider/JdbcProvider.java +++ b/backend/src/main/java/io/dataease/datasource/provider/JdbcProvider.java @@ -35,7 +35,9 @@ public class JdbcProvider extends DatasourceProvider { } catch (Exception e) { throw new Exception("ERROR:" + e.getMessage(), e); } finally { - connection.close(); + if(connection != null){ + connection.close(); + } } return list; } @@ -52,7 +54,9 @@ public class JdbcProvider extends DatasourceProvider { } catch (Exception e) { throw new Exception("ERROR:" + e.getMessage(), e); } finally { - connection.close(); + if(connection != null){ + connection.close(); + } } } @@ -70,7 +74,9 @@ public class JdbcProvider extends DatasourceProvider { } catch (Exception e) { throw new Exception("ERROR:" + e.getMessage(), e); } finally { - connection.close(); + if(connection != null){ + connection.close(); + } } } @@ -110,7 +116,9 @@ public class JdbcProvider extends DatasourceProvider { } catch (Exception e) { throw new Exception("ERROR:" + e.getMessage(), e); } finally { - connection.close(); + if(connection != null){ + connection.close(); + } } } @@ -135,7 +143,9 @@ public class JdbcProvider extends DatasourceProvider { } catch (Exception e) { throw new Exception("ERROR:" + e.getMessage(), e); } finally { - connection.close(); + if(connection != null){ + connection.close(); + } } } @@ -175,7 +185,9 @@ public class JdbcProvider extends DatasourceProvider { } catch (Exception e) { throw new Exception("ERROR: " + e.getMessage(), e); } finally { - con.close(); + if(con != null){ + con.close(); + } } } @@ -214,7 +226,9 @@ public class JdbcProvider extends DatasourceProvider { } catch (Exception e) { throw new Exception("ERROR:" + e.getMessage(), e); } finally { - connection.close(); + if(connection != null){ + connection.close(); + } } return list; }