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; }