Commit adbc0add authored by Nguyen Ha's avatar Nguyen Ha

fix sonar

parent 554d9852
...@@ -44,8 +44,7 @@ public class CampaignCfgServiceImpl implements CampaignCfgService { ...@@ -44,8 +44,7 @@ public class CampaignCfgServiceImpl implements CampaignCfgService {
ResultDTO resultDTO = new ResultDTO(); ResultDTO resultDTO = new ResultDTO();
SessionFactory sessionFactory = HibernateUtil.getSessionFactory(); SessionFactory sessionFactory = HibernateUtil.getSessionFactory();
Session session = sessionFactory.openSession(); Session session = null;
session.beginTransaction();
if (DataUtil.isNullOrZero(companySiteId)) { if (DataUtil.isNullOrZero(companySiteId)) {
resultDTO.setErrorCode(Constants.ApiErrorCode.ERROR); resultDTO.setErrorCode(Constants.ApiErrorCode.ERROR);
...@@ -54,6 +53,8 @@ public class CampaignCfgServiceImpl implements CampaignCfgService { ...@@ -54,6 +53,8 @@ public class CampaignCfgServiceImpl implements CampaignCfgService {
} }
try { try {
session = sessionFactory.openSession();
session.beginTransaction();
// StringBuilder sqlStrBuilder = new StringBuilder(); // StringBuilder sqlStrBuilder = new StringBuilder();
// sqlStrBuilder.append(SQLBuilder.getSqlQueryById(SQLBuilder.SQL_MODULE_CAMPAIGN_STATUS_MNG, "findAll-CampaignCompleteCode")); // sqlStrBuilder.append(SQLBuilder.getSqlQueryById(SQLBuilder.SQL_MODULE_CAMPAIGN_STATUS_MNG, "findAll-CampaignCompleteCode"));
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
...@@ -132,7 +133,7 @@ public class CampaignCfgServiceImpl implements CampaignCfgService { ...@@ -132,7 +133,7 @@ public class CampaignCfgServiceImpl implements CampaignCfgService {
resultDTO.setDescription(Constants.ApiErrorDesc.ERROR); resultDTO.setDescription(Constants.ApiErrorDesc.ERROR);
logger.error(e.getMessage(), e); logger.error(e.getMessage(), e);
} finally { } finally {
session.close(); if(session != null) session.close();
} }
return resultDTO; return resultDTO;
...@@ -278,8 +279,7 @@ public class CampaignCfgServiceImpl implements CampaignCfgService { ...@@ -278,8 +279,7 @@ public class CampaignCfgServiceImpl implements CampaignCfgService {
ResultDTO resultDTO = new ResultDTO(); ResultDTO resultDTO = new ResultDTO();
SessionFactory sessionFactory = HibernateUtil.getSessionFactory(); SessionFactory sessionFactory = HibernateUtil.getSessionFactory();
Session session = sessionFactory.openSession(); Session session = null;
session.beginTransaction();
if (DataUtil.isNullOrZero(completeCodeDTO.getCompanySiteId())) { if (DataUtil.isNullOrZero(completeCodeDTO.getCompanySiteId())) {
resultDTO.setErrorCode(Constants.ApiErrorCode.ERROR); resultDTO.setErrorCode(Constants.ApiErrorCode.ERROR);
...@@ -288,6 +288,8 @@ public class CampaignCfgServiceImpl implements CampaignCfgService { ...@@ -288,6 +288,8 @@ public class CampaignCfgServiceImpl implements CampaignCfgService {
} }
try { try {
session = sessionFactory.openSession();
session.beginTransaction();
// StringBuilder sqlStrBuilder = new StringBuilder(); // StringBuilder sqlStrBuilder = new StringBuilder();
// sqlStrBuilder.append(SQLBuilder.getSqlQueryById(SQLBuilder.SQL_MODULE_CAMPAIGN_STATUS_MNG, "get-max-value-completevalue")); // sqlStrBuilder.append(SQLBuilder.getSqlQueryById(SQLBuilder.SQL_MODULE_CAMPAIGN_STATUS_MNG, "get-max-value-completevalue"));
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
...@@ -323,9 +325,9 @@ public class CampaignCfgServiceImpl implements CampaignCfgService { ...@@ -323,9 +325,9 @@ public class CampaignCfgServiceImpl implements CampaignCfgService {
resultDTO.setDescription(Constants.ApiErrorDesc.ERROR); resultDTO.setDescription(Constants.ApiErrorDesc.ERROR);
logger.error(e.getMessage(), e); logger.error(e.getMessage(), e);
} finally { } finally {
session.close(); if(session != null) session.close();
return resultDTO;
} }
return resultDTO;
} }
@Override @Override
...@@ -367,8 +369,7 @@ public class CampaignCfgServiceImpl implements CampaignCfgService { ...@@ -367,8 +369,7 @@ public class CampaignCfgServiceImpl implements CampaignCfgService {
ResultDTO resultDTO = new ResultDTO(); ResultDTO resultDTO = new ResultDTO();
SessionFactory sessionFactory = HibernateUtil.getSessionFactory(); SessionFactory sessionFactory = HibernateUtil.getSessionFactory();
Session session = sessionFactory.openSession(); Session session = null;
session.beginTransaction();
if (DataUtil.isNullOrZero(campaignCompleteCodeId)) { if (DataUtil.isNullOrZero(campaignCompleteCodeId)) {
resultDTO.setErrorCode(Constants.ApiErrorCode.ERROR); resultDTO.setErrorCode(Constants.ApiErrorCode.ERROR);
...@@ -377,6 +378,8 @@ public class CampaignCfgServiceImpl implements CampaignCfgService { ...@@ -377,6 +378,8 @@ public class CampaignCfgServiceImpl implements CampaignCfgService {
} }
try { try {
session = sessionFactory.openSession();
session.beginTransaction();
// StringBuilder sqlStrBuilder = new StringBuilder(); // StringBuilder sqlStrBuilder = new StringBuilder();
// sqlStrBuilder.append(SQLBuilder.getSqlQueryById(SQLBuilder.SQL_MODULE_CAMPAIGN_STATUS_MNG,"findCampaignCodeById")); // sqlStrBuilder.append(SQLBuilder.getSqlQueryById(SQLBuilder.SQL_MODULE_CAMPAIGN_STATUS_MNG,"findCampaignCodeById"));
...@@ -437,7 +440,7 @@ public class CampaignCfgServiceImpl implements CampaignCfgService { ...@@ -437,7 +440,7 @@ public class CampaignCfgServiceImpl implements CampaignCfgService {
resultDTO.setDescription(Constants.ApiErrorDesc.ERROR); resultDTO.setDescription(Constants.ApiErrorDesc.ERROR);
logger.error(e.getMessage(), e); logger.error(e.getMessage(), e);
} finally { } finally {
session.close(); if(session != null) session.close();
} }
return resultDTO; return resultDTO;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment