Revert global exception msg

feature/traccar-sync^2
shamalka 2 years ago
parent 87ef31ab1b
commit d61814329c

@ -497,7 +497,6 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(obj.getString("error")).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(obj.getString("error")).build();
} else { } else {
int userId = obj.getInt("id"); int userId = obj.getInt("id");
String msg = "";
List<Integer> traccarValidIdList = new ArrayList<>(); List<Integer> traccarValidIdList = new ArrayList<>();
/*Get Device Id List*/ /*Get Device Id List*/
try { try {
@ -560,27 +559,27 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
TraccarHandlerConstants.Types.REMOVE_TYPE_SINGLE); TraccarHandlerConstants.Types.REMOVE_TYPE_SINGLE);
} }
} catch (JSONException e) { } catch (JSONException e) {
msg = "not a JSONObject. "; String msg = "not a JSONObject. ";
log.error(msg); log.error(msg);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
} catch (DeviceManagementException e) { } catch (DeviceManagementException e) {
msg = "Error occurred while fetching all enrolled devices. "; String msg = "Error occurred while fetching all enrolled devices. ";
log.error(msg, e); log.error(msg, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
} catch (DeviceAccessAuthorizationException e) { } catch (DeviceAccessAuthorizationException e) {
msg = "Error occurred while checking device access authorization. "; String msg = "Error occurred while checking device access authorization. ";
log.error(msg, e); log.error(msg, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
} catch (TrackerManagementDAOException e) { } catch (TrackerManagementDAOException e) {
msg = "Error occurred while mapping with deviceId ."; String msg = "Error occurred while mapping with deviceId .";
log.error(msg, e); log.error(msg, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
} catch (ExecutionException e) { } catch (ExecutionException e) {
msg = "ExecutionException occurred "; String msg = "ExecutionException occurred ";
log.error(msg, e); log.error(msg, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
} catch (InterruptedException e) { } catch (InterruptedException e) {
msg = "InterruptedException occurred "; String msg = "InterruptedException occurred ";
log.error(msg, e); log.error(msg, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
} }

@ -259,20 +259,19 @@ public class TraccarClientImpl implements TraccarClient {
serverUrl(HttpReportingUtil.trackerServer()))); serverUrl(HttpReportingUtil.trackerServer())));
String result = res.get(); String result = res.get();
if(result==""){ if (result.equals("")) {
String msg = "";
try { try {
TrackerManagementDAOFactory.beginTransaction(); TrackerManagementDAOFactory.beginTransaction();
trackerDAO.addTrackerUserDevicePermission(userId, deviceId); trackerDAO.addTrackerUserDevicePermission(userId, deviceId);
TrackerManagementDAOFactory.commitTransaction(); TrackerManagementDAOFactory.commitTransaction();
} catch (TrackerManagementDAOException e) { } catch (TrackerManagementDAOException e) {
TrackerManagementDAOFactory.rollbackTransaction(); TrackerManagementDAOFactory.rollbackTransaction();
msg = "Error occurred while mapping with deviceId ."; String msg = "Error occurred while mapping with deviceId .";
log.error(msg, e); log.error(msg, e);
throw new TrackerManagementDAOException(msg, e); throw new TrackerManagementDAOException(msg, e);
} catch (TransactionManagementException e) { } catch (TransactionManagementException e) {
TrackerManagementDAOFactory.rollbackTransaction(); TrackerManagementDAOFactory.rollbackTransaction();
msg = "Error occurred establishing the DB connection ."; String msg = "Error occurred establishing the DB connection .";
log.error(msg, e); log.error(msg, e);
throw new TrackerManagementDAOException(msg, e); throw new TrackerManagementDAOException(msg, e);
} finally { } finally {
@ -298,19 +297,18 @@ public class TraccarClientImpl implements TraccarClient {
String result = res.get(); String result = res.get();
if (result != null) { if (result != null) {
String msg = "";
try { try {
TrackerManagementDAOFactory.beginTransaction(); TrackerManagementDAOFactory.beginTransaction();
trackerDAO.removeTrackerUserDevicePermission(deviceId, userId, removeType); trackerDAO.removeTrackerUserDevicePermission(deviceId, userId, removeType);
TrackerManagementDAOFactory.commitTransaction(); TrackerManagementDAOFactory.commitTransaction();
} catch (TrackerManagementDAOException e) { } catch (TrackerManagementDAOException e) {
TrackerManagementDAOFactory.rollbackTransaction(); TrackerManagementDAOFactory.rollbackTransaction();
msg = "Error occurred while mapping with deviceId ."; String msg = "Error occurred while mapping with deviceId .";
log.error(msg, e); log.error(msg, e);
throw new TrackerManagementDAOException(msg, e); throw new TrackerManagementDAOException(msg, e);
} catch (TransactionManagementException e) { } catch (TransactionManagementException e) {
TrackerManagementDAOFactory.rollbackTransaction(); TrackerManagementDAOFactory.rollbackTransaction();
msg = "Error occurred establishing the DB connection ."; String msg = "Error occurred establishing the DB connection .";
log.error(msg, e); log.error(msg, e);
throw new TrackerManagementDAOException(msg, e); throw new TrackerManagementDAOException(msg, e);
} finally { } finally {
@ -321,17 +319,16 @@ public class TraccarClientImpl implements TraccarClient {
public List<TrackerPermissionInfo> getUserIdofPermissionByUserIdNIdList(int userId, List<Integer> NotInDeviceIdList) public List<TrackerPermissionInfo> getUserIdofPermissionByUserIdNIdList(int userId, List<Integer> NotInDeviceIdList)
throws TrackerManagementDAOException { throws TrackerManagementDAOException {
String msg = "";
try { try {
TrackerManagementDAOFactory.openConnection(); TrackerManagementDAOFactory.openConnection();
return trackerDAO.getUserIdofPermissionByUserIdNIdList(userId, NotInDeviceIdList); return trackerDAO.getUserIdofPermissionByUserIdNIdList(userId, NotInDeviceIdList);
} catch (TrackerManagementDAOException e) { } catch (TrackerManagementDAOException e) {
TrackerManagementDAOFactory.rollbackTransaction(); TrackerManagementDAOFactory.rollbackTransaction();
msg = "Error occurred while mapping with deviceId ."; String msg = "Error occurred while mapping with deviceId .";
log.error(msg, e); log.error(msg, e);
throw new TrackerManagementDAOException(msg, e); throw new TrackerManagementDAOException(msg, e);
} catch (SQLException e) { } catch (SQLException e) {
msg = "Error occurred establishing the DB connection ."; String msg = "Error occurred establishing the DB connection .";
log.error(msg, e); log.error(msg, e);
throw new TrackerManagementDAOException(msg, e); throw new TrackerManagementDAOException(msg, e);
} finally { } finally {
@ -340,16 +337,15 @@ public class TraccarClientImpl implements TraccarClient {
} }
public TrackerDeviceInfo getTrackerDevice(int deviceId, int tenantId) throws TrackerManagementDAOException { public TrackerDeviceInfo getTrackerDevice(int deviceId, int tenantId) throws TrackerManagementDAOException {
String msg = "";
try { try {
TrackerManagementDAOFactory.openConnection(); TrackerManagementDAOFactory.openConnection();
return trackerDAO.getTrackerDevice(deviceId, tenantId); return trackerDAO.getTrackerDevice(deviceId, tenantId);
} catch (SQLException e) { } catch (SQLException e) {
msg = "Error occurred establishing the DB connection ."; String msg = "Error occurred establishing the DB connection .";
log.error(msg, e); log.error(msg, e);
throw new TrackerManagementDAOException(msg, e); throw new TrackerManagementDAOException(msg, e);
} catch (TrackerManagementDAOException e) { } catch (TrackerManagementDAOException e) {
msg="Could not add new device location"; String msg = "Could not add new device location";
log.error(msg, e); log.error(msg, e);
throw new TrackerManagementDAOException(msg, e); throw new TrackerManagementDAOException(msg, e);
} finally { } finally {
@ -360,16 +356,15 @@ public class TraccarClientImpl implements TraccarClient {
public boolean getUserIdofPermissionByDeviceIdNUserId(int deviceId, int userId) public boolean getUserIdofPermissionByDeviceIdNUserId(int deviceId, int userId)
throws TrackerManagementDAOException { throws TrackerManagementDAOException {
Boolean result = false; Boolean result = false;
String msg = "";
try { try {
TrackerManagementDAOFactory.openConnection(); TrackerManagementDAOFactory.openConnection();
result = trackerDAO.getUserIdofPermissionByDeviceIdNUserId(deviceId, userId); result = trackerDAO.getUserIdofPermissionByDeviceIdNUserId(deviceId, userId);
} catch (TrackerManagementDAOException e) { } catch (TrackerManagementDAOException e) {
msg = "Error occurred while mapping with deviceId ."; String msg = "Error occurred while mapping with deviceId .";
log.error(msg, e); log.error(msg, e);
throw new TrackerManagementDAOException(msg, e); throw new TrackerManagementDAOException(msg, e);
} catch (SQLException e) { } catch (SQLException e) {
msg = "Error occurred establishing the DB connection ."; String msg = "Error occurred establishing the DB connection .";
log.error(msg, e); log.error(msg, e);
throw new TrackerManagementDAOException(msg, e); throw new TrackerManagementDAOException(msg, e);
} finally { } finally {
@ -380,6 +375,7 @@ public class TraccarClientImpl implements TraccarClient {
/** /**
* Add Traccar Device operation. * Add Traccar Device operation.
*
* @param traccarDevice with DeviceName UniqueId, Status, Disabled LastUpdate, PositionId, GroupId * @param traccarDevice with DeviceName UniqueId, Status, Disabled LastUpdate, PositionId, GroupId
* Model, Contact, Category, fenceIds * Model, Contact, Category, fenceIds
* @throws TrackerManagementDAOException Failed while add Traccar Device the operation * @throws TrackerManagementDAOException Failed while add Traccar Device the operation
@ -387,21 +383,20 @@ public class TraccarClientImpl implements TraccarClient {
public void addDevice(TraccarDevice traccarDevice, int tenantId) throws public void addDevice(TraccarDevice traccarDevice, int tenantId) throws
TrackerManagementDAOException, TrackerAlreadyExistException, ExecutionException, InterruptedException { TrackerManagementDAOException, TrackerAlreadyExistException, ExecutionException, InterruptedException {
TrackerDeviceInfo trackerDeviceInfo = null; TrackerDeviceInfo trackerDeviceInfo = null;
String msg = "";
try { try {
TrackerManagementDAOFactory.openConnection(); TrackerManagementDAOFactory.openConnection();
trackerDeviceInfo = trackerDAO.getTrackerDevice(traccarDevice.getId(), tenantId); trackerDeviceInfo = trackerDAO.getTrackerDevice(traccarDevice.getId(), tenantId);
if (trackerDeviceInfo != null) { if (trackerDeviceInfo != null) {
msg = "The device already exist"; String msg = "The device already exist";
log.error(msg); log.error(msg);
throw new TrackerAlreadyExistException(msg); throw new TrackerAlreadyExistException(msg);
} }
} catch (TrackerManagementDAOException e) { } catch (TrackerManagementDAOException e) {
msg = "Error occurred while mapping with deviceId ."; String msg = "Error occurred while mapping with deviceId .";
log.error(msg, e); log.error(msg, e);
throw new TrackerManagementDAOException(msg, e); throw new TrackerManagementDAOException(msg, e);
} catch (SQLException e) { } catch (SQLException e) {
msg = "Error occurred establishing the DB connection ."; String msg = "Error occurred establishing the DB connection .";
log.error(msg, e); log.error(msg, e);
throw new TrackerManagementDAOException(msg, e); throw new TrackerManagementDAOException(msg, e);
} finally { } finally {
@ -434,12 +429,12 @@ public class TraccarClientImpl implements TraccarClient {
TrackerManagementDAOFactory.commitTransaction(); TrackerManagementDAOFactory.commitTransaction();
} catch (TrackerManagementDAOException e) { } catch (TrackerManagementDAOException e) {
TrackerManagementDAOFactory.rollbackTransaction(); TrackerManagementDAOFactory.rollbackTransaction();
msg = "Error occurred while mapping with deviceId ."; String msg = "Error occurred while mapping with deviceId .";
log.error(msg, e); log.error(msg, e);
throw new TrackerManagementDAOException(msg, e); throw new TrackerManagementDAOException(msg, e);
} catch (TransactionManagementException e) { } catch (TransactionManagementException e) {
TrackerManagementDAOFactory.rollbackTransaction(); TrackerManagementDAOFactory.rollbackTransaction();
msg = "Error occurred establishing the DB connection ."; String msg = "Error occurred establishing the DB connection .";
log.error(msg, e); log.error(msg, e);
throw new TrackerManagementDAOException(msg, e); throw new TrackerManagementDAOException(msg, e);
} finally { } finally {
@ -455,21 +450,21 @@ public class TraccarClientImpl implements TraccarClient {
/** /**
* Add Device GPS Location operation. * Add Device GPS Location operation.
*
* @param deviceInfo with DeviceIdentifier, Timestamp, Lat, Lon, Bearing, Speed, ignition * @param deviceInfo with DeviceIdentifier, Timestamp, Lat, Lon, Bearing, Speed, ignition
*/ */
public void updateLocation(TraccarDevice device, TraccarPosition deviceInfo, int tenantId) throws public void updateLocation(TraccarDevice device, TraccarPosition deviceInfo, int tenantId) throws
TrackerManagementDAOException, TrackerAlreadyExistException, ExecutionException, InterruptedException { TrackerManagementDAOException, TrackerAlreadyExistException, ExecutionException, InterruptedException {
TrackerDeviceInfo trackerDeviceInfo = null; TrackerDeviceInfo trackerDeviceInfo = null;
String msg = "";
try { try {
TrackerManagementDAOFactory.openConnection(); TrackerManagementDAOFactory.openConnection();
trackerDeviceInfo = trackerDAO.getTrackerDevice(device.getId(), tenantId); trackerDeviceInfo = trackerDAO.getTrackerDevice(device.getId(), tenantId);
} catch (SQLException e) { } catch (SQLException e) {
msg = "Error occurred establishing the DB connection ."; String msg = "Error occurred establishing the DB connection .";
log.error(msg, e); log.error(msg, e);
throw new TrackerManagementDAOException(msg, e); throw new TrackerManagementDAOException(msg, e);
} catch (TrackerManagementDAOException e) { } catch (TrackerManagementDAOException e) {
msg = "Could not add new device location"; String msg = "Could not add new device location";
log.error(msg, e); log.error(msg, e);
throw new TrackerManagementDAOException(msg, e); throw new TrackerManagementDAOException(msg, e);
} finally { } finally {
@ -497,14 +492,13 @@ public class TraccarClientImpl implements TraccarClient {
/** /**
* Dis-enroll a Device operation. * Dis-enroll a Device operation.
*
* @param deviceId identified via deviceIdentifier * @param deviceId identified via deviceIdentifier
* @throws TrackerManagementDAOException Failed while dis-enroll a Traccar Device operation * @throws TrackerManagementDAOException Failed while dis-enroll a Traccar Device operation
*/ */
public void disEnrollDevice(int deviceId, int tenantId) throws TrackerManagementDAOException, ExecutionException, InterruptedException { public void disEnrollDevice(int deviceId, int tenantId) throws TrackerManagementDAOException, ExecutionException, InterruptedException {
TrackerDeviceInfo trackerDeviceInfo = null; TrackerDeviceInfo trackerDeviceInfo = null;
List<TrackerPermissionInfo> trackerPermissionInfo = null; List<TrackerPermissionInfo> trackerPermissionInfo = null;
String msg = "";
try { try {
TrackerManagementDAOFactory.beginTransaction(); TrackerManagementDAOFactory.beginTransaction();
trackerDeviceInfo = trackerDAO.getTrackerDevice(deviceId, tenantId); trackerDeviceInfo = trackerDAO.getTrackerDevice(deviceId, tenantId);
@ -519,18 +513,17 @@ public class TraccarClientImpl implements TraccarClient {
} }
} catch (TransactionManagementException e) { } catch (TransactionManagementException e) {
TrackerManagementDAOFactory.rollbackTransaction(); TrackerManagementDAOFactory.rollbackTransaction();
msg = "Error occurred establishing the DB connection"; String msg = "Error occurred establishing the DB connection";
log.error(msg, e); log.error(msg, e);
throw new TrackerManagementDAOException(msg, e); throw new TrackerManagementDAOException(msg, e);
} catch (TrackerManagementDAOException e) { } catch (TrackerManagementDAOException e) {
TrackerManagementDAOFactory.rollbackTransaction(); TrackerManagementDAOFactory.rollbackTransaction();
msg = "Error occurred while mapping with deviceId"; String msg = "Error occurred while mapping with deviceId";
log.error(msg, e); log.error(msg, e);
throw new TrackerManagementDAOException(msg, e); throw new TrackerManagementDAOException(msg, e);
} finally { } finally {
TrackerManagementDAOFactory.closeConnection(); TrackerManagementDAOFactory.closeConnection();
} }
log.info("--------Disenrolling Device--------"); log.info("--------Disenrolling Device--------");
//Delete from traccar //Delete from traccar
if (trackerDeviceInfo != null) { if (trackerDeviceInfo != null) {
@ -556,27 +549,27 @@ public class TraccarClientImpl implements TraccarClient {
/** /**
* Add Traccar Device operation. * Add Traccar Device operation.
*
* @param groupInfo with groupName * @param groupInfo with groupName
* @throws TrackerManagementDAOException Failed while add Traccar Device the operation * @throws TrackerManagementDAOException Failed while add Traccar Device the operation
*/ */
public void addGroup(TraccarGroups groupInfo, int groupId, int tenantId) throws public void addGroup(TraccarGroups groupInfo, int groupId, int tenantId) throws
TrackerManagementDAOException, TrackerAlreadyExistException, ExecutionException, InterruptedException { TrackerManagementDAOException, TrackerAlreadyExistException, ExecutionException, InterruptedException {
TrackerGroupInfo trackerGroupInfo = null; TrackerGroupInfo trackerGroupInfo = null;
String msg = "";
try { try {
TrackerManagementDAOFactory.openConnection(); TrackerManagementDAOFactory.openConnection();
trackerGroupInfo = trackerDAO.getTrackerGroup(groupId, tenantId); trackerGroupInfo = trackerDAO.getTrackerGroup(groupId, tenantId);
if (trackerGroupInfo != null) { if (trackerGroupInfo != null) {
msg = "The group already exit"; String msg = "The group already exit";
log.error(msg); log.error(msg);
throw new TrackerAlreadyExistException(msg); throw new TrackerAlreadyExistException(msg);
} }
} catch (TrackerManagementDAOException e) { } catch (TrackerManagementDAOException e) {
msg = "Error occurred while mapping with groupId."; String msg = "Error occurred while mapping with groupId.";
log.error(msg, e); log.error(msg, e);
throw new TrackerManagementDAOException(msg, e); throw new TrackerManagementDAOException(msg, e);
} catch (SQLException e) { } catch (SQLException e) {
msg = "Error occurred establishing the DB connection."; String msg = "Error occurred establishing the DB connection.";
log.error(msg, e); log.error(msg, e);
throw new TrackerManagementDAOException(msg, e); throw new TrackerManagementDAOException(msg, e);
} finally { } finally {
@ -608,12 +601,12 @@ public class TraccarClientImpl implements TraccarClient {
trackerDAO.updateTrackerGroupIdANDStatus(trackerGroupInfo.getTraccarGroupId(), groupId, tenantId, 1); trackerDAO.updateTrackerGroupIdANDStatus(trackerGroupInfo.getTraccarGroupId(), groupId, tenantId, 1);
} }
} catch (TrackerManagementDAOException e) { } catch (TrackerManagementDAOException e) {
msg = "Error occurred while mapping with deviceId. "; String msg = "Error occurred while mapping with deviceId. ";
log.error(msg, e); log.error(msg, e);
TrackerManagementDAOFactory.rollbackTransaction(); TrackerManagementDAOFactory.rollbackTransaction();
throw new TrackerManagementDAOException(msg, e); throw new TrackerManagementDAOException(msg, e);
} catch (TransactionManagementException e) { } catch (TransactionManagementException e) {
msg = "Error occurred establishing the DB connection. "; String msg = "Error occurred establishing the DB connection. ";
log.error(msg, e); log.error(msg, e);
TrackerManagementDAOFactory.rollbackTransaction(); TrackerManagementDAOFactory.rollbackTransaction();
throw new TrackerManagementDAOException(msg, e); throw new TrackerManagementDAOException(msg, e);
@ -630,21 +623,21 @@ public class TraccarClientImpl implements TraccarClient {
/** /**
* update Traccar Group operation. * update Traccar Group operation.
*
* @param groupInfo with groupName * @param groupInfo with groupName
* @throws TrackerManagementDAOException Failed while add Traccar Device the operation * @throws TrackerManagementDAOException Failed while add Traccar Device the operation
*/ */
public void updateGroup(TraccarGroups groupInfo, int groupId, int tenantId) throws public void updateGroup(TraccarGroups groupInfo, int groupId, int tenantId) throws
TrackerManagementDAOException, TrackerAlreadyExistException, ExecutionException, InterruptedException { TrackerManagementDAOException, TrackerAlreadyExistException, ExecutionException, InterruptedException {
TrackerGroupInfo res = null; TrackerGroupInfo res = null;
String msg = "";
try { try {
TrackerManagementDAOFactory.openConnection(); TrackerManagementDAOFactory.openConnection();
res = trackerDAO.getTrackerGroup(groupId, tenantId); res = trackerDAO.getTrackerGroup(groupId, tenantId);
} catch (SQLException e) { } catch (SQLException e) {
msg = "Error occurred establishing the DB connection. "; String msg = "Error occurred establishing the DB connection. ";
log.error(msg, e); log.error(msg, e);
} catch (TrackerManagementDAOException e) { } catch (TrackerManagementDAOException e) {
msg="Could not find traccar group details. "; String msg = "Could not find traccar group details. ";
log.error(msg, e); log.error(msg, e);
} finally { } finally {
TrackerManagementDAOFactory.closeConnection(); TrackerManagementDAOFactory.closeConnection();
@ -661,12 +654,12 @@ public class TraccarClientImpl implements TraccarClient {
TrackerManagementDAOFactory.commitTransaction(); TrackerManagementDAOFactory.commitTransaction();
} catch (TrackerManagementDAOException e) { } catch (TrackerManagementDAOException e) {
TrackerManagementDAOFactory.rollbackTransaction(); TrackerManagementDAOFactory.rollbackTransaction();
msg="Could not update the traccar group. "; String msg = "Could not update the traccar group. ";
log.error(msg, e); log.error(msg, e);
throw new TrackerManagementDAOException(msg, e); throw new TrackerManagementDAOException(msg, e);
} catch (TransactionManagementException e) { } catch (TransactionManagementException e) {
TrackerManagementDAOFactory.rollbackTransaction(); TrackerManagementDAOFactory.rollbackTransaction();
msg = "Error occurred establishing the DB connection. "; String msg = "Error occurred establishing the DB connection. ";
log.error(msg, e); log.error(msg, e);
throw new TrackerManagementDAOException(msg, e); throw new TrackerManagementDAOException(msg, e);
} finally { } finally {
@ -690,13 +683,13 @@ public class TraccarClientImpl implements TraccarClient {
/** /**
* Add Traccar Device operation. * Add Traccar Device operation.
*
* @param groupId * @param groupId
* @throws TrackerManagementDAOException Failed while add Traccar Device the operation * @throws TrackerManagementDAOException Failed while add Traccar Device the operation
*/ */
public void deleteGroup(int groupId, int tenantId) throws TrackerManagementDAOException, ExecutionException, InterruptedException { public void deleteGroup(int groupId, int tenantId) throws TrackerManagementDAOException, ExecutionException, InterruptedException {
TrackerGroupInfo res = null; TrackerGroupInfo res = null;
JSONObject obj = null; JSONObject obj = null;
String msg = "";
try { try {
TrackerManagementDAOFactory.beginTransaction(); TrackerManagementDAOFactory.beginTransaction();
res = trackerDAO.getTrackerGroup(groupId, tenantId); res = trackerDAO.getTrackerGroup(groupId, tenantId);
@ -716,12 +709,12 @@ public class TraccarClientImpl implements TraccarClient {
} }
} catch (TransactionManagementException e) { } catch (TransactionManagementException e) {
TrackerManagementDAOFactory.rollbackTransaction(); TrackerManagementDAOFactory.rollbackTransaction();
msg = "Error occurred establishing the DB connection. "; String msg = "Error occurred establishing the DB connection. ";
log.error(msg, e); log.error(msg, e);
throw new TrackerManagementDAOException(msg, e); throw new TrackerManagementDAOException(msg, e);
} catch (TrackerManagementDAOException e) { } catch (TrackerManagementDAOException e) {
TrackerManagementDAOFactory.rollbackTransaction(); TrackerManagementDAOFactory.rollbackTransaction();
msg = "Error occurred while mapping with groupId. "; String msg = "Error occurred while mapping with groupId. ";
log.error(msg, e); log.error(msg, e);
throw new TrackerManagementDAOException(msg, e); throw new TrackerManagementDAOException(msg, e);
} finally { } finally {

Loading…
Cancel
Save