提交 91eef920 authored 作者: taojinlong's avatar taojinlong

fix: 处理连接池为空的情况

上级 3733b869
...@@ -35,7 +35,9 @@ public class JdbcProvider extends DatasourceProvider { ...@@ -35,7 +35,9 @@ public class JdbcProvider extends DatasourceProvider {
} catch (Exception e) { } catch (Exception e) {
throw new Exception("ERROR:" + e.getMessage(), e); throw new Exception("ERROR:" + e.getMessage(), e);
} finally { } finally {
connection.close(); if(connection != null){
connection.close();
}
} }
return list; return list;
} }
...@@ -52,7 +54,9 @@ public class JdbcProvider extends DatasourceProvider { ...@@ -52,7 +54,9 @@ public class JdbcProvider extends DatasourceProvider {
} catch (Exception e) { } catch (Exception e) {
throw new Exception("ERROR:" + e.getMessage(), e); throw new Exception("ERROR:" + e.getMessage(), e);
} finally { } finally {
connection.close(); if(connection != null){
connection.close();
}
} }
} }
...@@ -70,7 +74,9 @@ public class JdbcProvider extends DatasourceProvider { ...@@ -70,7 +74,9 @@ public class JdbcProvider extends DatasourceProvider {
} catch (Exception e) { } catch (Exception e) {
throw new Exception("ERROR:" + e.getMessage(), e); throw new Exception("ERROR:" + e.getMessage(), e);
} finally { } finally {
connection.close(); if(connection != null){
connection.close();
}
} }
} }
...@@ -110,7 +116,9 @@ public class JdbcProvider extends DatasourceProvider { ...@@ -110,7 +116,9 @@ public class JdbcProvider extends DatasourceProvider {
} catch (Exception e) { } catch (Exception e) {
throw new Exception("ERROR:" + e.getMessage(), e); throw new Exception("ERROR:" + e.getMessage(), e);
} finally { } finally {
connection.close(); if(connection != null){
connection.close();
}
} }
} }
...@@ -135,7 +143,9 @@ public class JdbcProvider extends DatasourceProvider { ...@@ -135,7 +143,9 @@ public class JdbcProvider extends DatasourceProvider {
} catch (Exception e) { } catch (Exception e) {
throw new Exception("ERROR:" + e.getMessage(), e); throw new Exception("ERROR:" + e.getMessage(), e);
} finally { } finally {
connection.close(); if(connection != null){
connection.close();
}
} }
} }
...@@ -175,7 +185,9 @@ public class JdbcProvider extends DatasourceProvider { ...@@ -175,7 +185,9 @@ public class JdbcProvider extends DatasourceProvider {
} catch (Exception e) { } catch (Exception e) {
throw new Exception("ERROR: " + e.getMessage(), e); throw new Exception("ERROR: " + e.getMessage(), e);
} finally { } finally {
con.close(); if(con != null){
con.close();
}
} }
} }
...@@ -214,7 +226,9 @@ public class JdbcProvider extends DatasourceProvider { ...@@ -214,7 +226,9 @@ public class JdbcProvider extends DatasourceProvider {
} catch (Exception e) { } catch (Exception e) {
throw new Exception("ERROR:" + e.getMessage(), e); throw new Exception("ERROR:" + e.getMessage(), e);
} finally { } finally {
connection.close(); if(connection != null){
connection.close();
}
} }
return list; return list;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论