Improve error messages logging

feature/appm-store/pbac
lasanthaDLPDS 5 years ago
parent b3860d502e
commit 7a48f72f6b

@ -35,7 +35,7 @@ public interface LifecycleStateDAO {
* @return Latest Lifecycle State for the given application release
* @throws LifeCycleManagementDAOException Lifecycle Management DAO Exception.
*/
LifecycleState getLatestLifeCycleState(String uuid) throws LifeCycleManagementDAOException;
LifecycleState getLatestLifecycleState(String uuid) throws LifeCycleManagementDAOException;
/**
* To get all changed lifecycle states for the given application release id.

@ -84,12 +84,12 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection to create an application which has "
+ "application name " + applicationDTO.getName();
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "Error occurred while executing SQL to create an application which has application name "
+ applicationDTO.getName();
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -231,12 +231,12 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection while getting application list for the "
+ "tenant " + tenantId;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "Error occurred while getting application list for the tenant " + tenantId + ". While "
+ "executing " + sql;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -330,12 +330,15 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
}
return 0;
} catch (SQLException e) {
throw new ApplicationManagementDAOException("Error occurred while getting application list for the tenant"
+ " " + tenantId + ". While executing " + sql, e);
String msg = "Error occurred while getting application list for the tenant" + " " + tenantId
+ ". While executing " + sql;
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (DBConnectionException e) {
throw new ApplicationManagementDAOException("Error occurred while obtaining the DB connection while "
+ "getting application list for the tenant " + tenantId,
e);
String msg = "Error occurred while obtaining the DB connection while getting application list for the "
+ "tenant " + tenantId;
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} finally {
DAOUtil.cleanupResources(stmt, rs);
}
@ -398,16 +401,16 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection to get application for application release "
+ "UUID: " + releaseUuid;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "Error occurred while getting application details with app release uuid " + releaseUuid
+ " while executing query. Executed query: " + sql;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (UnexpectedServerErrorException e) {
String msg = "Found more than one application for application release UUID: " + releaseUuid;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -471,16 +474,16 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection to get application and related application "
+ "release for release UUID: " + releaseUuid;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "Error occurred while getting application and related app release details for app release "
+ "uuid " + releaseUuid + " while executing query. Executed query: " + sql;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (UnexpectedServerErrorException e) {
String msg = "Found more than one application for application release UUID: " + releaseUuid;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -543,16 +546,16 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection to get application for application ID: "
+ applicationId;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "Error occurred to get application details with app id " + applicationId + " while executing "
+ "query. Query: " + sql;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (UnexpectedServerErrorException e) {
String msg = "Found more than one application for application ID: " + applicationId;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -580,11 +583,11 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
}
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection to update the application.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "Error occurred when executing SQL to update an application. Executed query: " + sql;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -608,11 +611,11 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
}
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection to update the application rating.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "Error occurred when obtaining database connection for updating the application rating.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -634,12 +637,12 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection to retire application which has application "
+ "ID: " + appId;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "Error occurred while executing SQL to retire an application which has application ID "
+ appId;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -665,11 +668,11 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
}
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection when adding tags";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "SQL Error occurred while adding tags. Executed Query: " + sql;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -701,11 +704,11 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
}
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection when getting all tags";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "SQL Error occurred while getting all tags";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -737,11 +740,11 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
}
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection when getting all categories.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "SQL Error occurred while getting all categories. Executed query: " + sql;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -776,11 +779,11 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection when getting category ids for given "
+ "category names";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "SQL Error occurred while getting all categories.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -805,11 +808,11 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection when getting distinct category ids in "
+ "category mapping";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "SQL Error occurred while getting distinct category ids in category mapping.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -841,11 +844,11 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection when getting category for given category "
+ "name.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "SQL Error occurred while getting category for category name. Executed query " + sql;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -871,11 +874,11 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
}
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection when adding categories.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "SQL Error occurred while adding categories. Executed query " + sql;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -904,11 +907,11 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
}
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection when adding data into category mapping.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "SQL Error occurred while adding data into category mapping.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -933,12 +936,12 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection when deleting category mapping of "
+ "application ID: " + applicationId;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "SQL Error occurred when deleting category mapping of application ID: " + applicationId
+ " Executed query: " + sql;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -967,11 +970,11 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
}
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection when deleting category mapping.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "SQL Error occurred when deleting category mapping. Executed query: " + sql;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -996,11 +999,11 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection when deleting category which has ID: "
+ categoryId;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "SQL Error occurred when deleting category which has ID: " + categoryId + ". Query: " + sql;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -1027,12 +1030,12 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection when updating category which has ID: "
+ categoryDTO.getId();
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "Error occurred when updating category which has ID: " + categoryDTO.getId() + ". Executed "
+ "query: " + sql;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -1066,11 +1069,11 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
return tagIds;
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection when getting tag IDs for given tag names.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "SQL Error occurred while getting tag IDs for given tag names";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -1102,10 +1105,11 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection when getting tag for given tag name: "
+ tagName;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "SQL Error occurred while getting tag for tag name: " + tagName + ". Executed query: " + sql;
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -1133,11 +1137,11 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection when getting distinct tag ids in tag "
+ "mapping";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "SQL Error occurred while getting distinct tag ids in tag mapping. Executed query: " + sql;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -1168,11 +1172,11 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection to add tags for application which has ID: "
+ applicationId;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "SQL Error occurred when adding tags for application which has the ID: " + applicationId;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -1203,12 +1207,12 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection to get application tags. Application Id: "
+ appId;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "SQL error occured while getting application tags. ApplicationId: " + appId + " Executed "
+ "query " + sql;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -1237,12 +1241,12 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection when verifying the existence of a tag "
+ "mapping. Application ID " + applicationId + " tag ID: " + tagId;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "SQL Error occurred when verifying the existence of a tag mapping. Application ID "
+ applicationId + " tag ID " + tagId;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -1270,12 +1274,12 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection to verify whether tag is associated with at "
+ "least one application. Tag ID " + tagId;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "Error occurred while executing the query to verify whether tag is associated with at least "
+ "one application. Tag ID " + tagId;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -1305,12 +1309,12 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection to delete tag mapping. Application ID: "
+ applicationId;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "SQL Error occurred while executing the query to delete tag mapping. Application ID: "
+ applicationId;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -1337,12 +1341,12 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection to delete a tag mapping. Application ID "
+ applicationId + " tag ID " + tagId;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "SQL Error occurred while executing the query to delete a tag mapping. Application ID "
+ applicationId + " tag ID " + tagId;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -1367,12 +1371,12 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection when deleting application tags for "
+ "application ID: " + applicationId;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "SQL Error occurred when deleting application tags for application ID: " + applicationId + "."
+ " Executed query " + sql;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -1397,12 +1401,12 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection when deleting application tag which has tag"
+ " ID: " + tagId;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "SQL error occurred when deleting application tag which has tag ID: " + tagId + ". executed "
+ "query: " + sql;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -1426,11 +1430,11 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
}
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection when deleting tag which has ID: " + tagId;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "SQL Error occurred when deleting tag which has ID: " + tagId + ". Executed query " + sql;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -1457,12 +1461,12 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection to update tag which has ID: "
+ tagDTO.getId();
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "SQL Error occurred when updating tag which has ID: " + tagDTO.getId() + ". Executed query: "
+ sql;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -1493,12 +1497,12 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection to get application categories for "
+ "application which has ID " + appId;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "SQL error occurred while executing query to get application categories for "
+ "application which has ID " + appId;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -1525,12 +1529,12 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection when verifying the existence of a category "
+ "mapping for category ID " + categoryId;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "SQL Error occurred when verifying the existence of a category mapping for category ID "
+ categoryId;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -1556,12 +1560,12 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection to check whether the existence of "
+ "application name for device type which has device type ID " + deviceTypeId;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "Error occurred while executing query to check whether the existence of application name for "
+ "device type which has device type ID " + deviceTypeId + ". executed query " + sql;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -1582,12 +1586,12 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection to delete application for application id::."
+ appId;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "SQL Error occurred while deleting application for application ID: " + appId + " Executed "
+ "query " + sql;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}

@ -102,11 +102,11 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
} catch (DBConnectionException e) {
String msg = "Database Connection error occurred while trying to release a new version for application which"
+ " has app ID: " + appId;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "SQL Exception while trying to release an application by executing the query " + sql;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -151,13 +151,13 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
} catch (DBConnectionException e) {
String msg = "Database connection error occurred while trying to get application release details which has "
+ "UUID: " + uuid;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg =
"Error while getting application release details which has UUID: " + uuid + " , while executing"
+ " the query " + sql;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -181,11 +181,11 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
} catch (DBConnectionException e) {
String msg = "Database connection error occurred while trying to update the application release rating "
+ "value for UUID: " + uuid;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "SQL exception occured while updating the release rating value. Executed query " + sql;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -215,12 +215,12 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
} catch (DBConnectionException e) {
String msg = "Database connection error occured when try to get application release rating which has "
+ "application release UUID: " + uuid;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "SQL exception occured whn processing query: " + sql + " to get application release rating "
+ "which has application release uuid: " + uuid;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -248,12 +248,12 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
} catch (DBConnectionException e) {
String msg = "Database connection exception occurred when getting all release rating values for a "
+ "particular application.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "SQL exception occurred while getting all release rating values for a particular application. "
+ "Executed query is" + sql;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -310,12 +310,12 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
} catch (DBConnectionException e) {
String msg = "Database connection exception occured while trying to update the application release which "
+ "has application release ID: " + applicationReleaseDTO.getId();
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "SQL exception occured while updating the application release which has release ID: "
+ applicationReleaseDTO.getId() + ". Executed query is " + sql;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
return applicationReleaseDTO;
@ -335,12 +335,12 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
} catch (DBConnectionException e) {
String msg = "Database connection exception occurred while trying to delete the application release which "
+ "has ID: " + id;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "SQL exception occurred while deleting the release for release ID: " + id + ",while executing"
+ " the query sql " + sql;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -362,12 +362,12 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
} catch (DBConnectionException e) {
String msg = "Database connection exception occurred while trying to delete application releases for given "
+ "application release ids";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "SQL exception occurred while execute delete query for deleting given application releases. "
+ "Executed query: " + sql;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -395,12 +395,12 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
} catch (DBConnectionException e) {
String msg = "Database connection error occurred while verifying release existence for app release hash "
+ "value. Hash value: " + hashVal;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "Error occurred while getting application release details for application release hash value: "
+ hashVal + " While executing query ";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -434,12 +434,12 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection to get application release package name "
+ "which has application release UUID: " + releaseUuid;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "Error occurred while getting package name of the application release with app UUID: "
+ releaseUuid;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -472,12 +472,12 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection to get hash value for application release "
+ "which has application release UUID: " + uuid;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "Error occurred when executing query to get application release hash value which has "
+ "application release uuid: " + uuid + ". Executed query: " + sql;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -506,12 +506,12 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection to verify the existence of package name for "
+ "active application release. Package name: " + packageName;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "SQL error occurred while verifying the existence of package name for active application "
+ "release. package name: " + packageName;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -541,12 +541,12 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
String msg = "Error occurred while obtaining the DB connection to verify the existence of app release for "
+ "application release uuid ;" + releaseUuid + " and application release state "
+ installableStateName;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "Error occurred while executing SQL to verify the existence of app release for application "
+ "release uuid ;" + releaseUuid + " and application release state " + installableStateName;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}

@ -45,7 +45,7 @@ public class GenericLifecycleStateDAOImpl extends AbstractDAOImpl implements Lif
private static final Log log = LogFactory.getLog(GenericLifecycleStateDAOImpl.class);
@Override
public LifecycleState getLatestLifeCycleState(String uuid) throws LifeCycleManagementDAOException{
public LifecycleState getLatestLifecycleState(String uuid) throws LifeCycleManagementDAOException{
String sql = "SELECT "
+ "CURRENT_STATE, "
+ "PREVIOUS_STATE, "
@ -66,12 +66,12 @@ public class GenericLifecycleStateDAOImpl extends AbstractDAOImpl implements Lif
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection to get latest lifecycle state for a specific"
+ " application. Application release UUID: " + uuid;
log.error(msg);
log.error(msg, e);
throw new LifeCycleManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "Error occurred while executing query to get latest lifecycle state for a specific "
+ "application. Application release UUID: " + uuid + ". Executed Query: " + sql;
log.error(msg);
log.error(msg, e);
throw new LifeCycleManagementDAOException(msg, e);
}
}
@ -99,14 +99,18 @@ public class GenericLifecycleStateDAOImpl extends AbstractDAOImpl implements Lif
rs = stmt.executeQuery();
if (rs.next()) {
return rs.getString("UPDATED_BY");
}
return null;
} catch (SQLException e) {
throw new LifeCycleManagementDAOException("Error occurred while getting application List", e);
} catch (DBConnectionException e) {
throw new LifeCycleManagementDAOException("Error occurred while obtaining the DB connection to get latest"
+ " lifecycle state for a specific application", e);
String msg = "Error occurred while obtaining the DB connection to get the created user of a release which "
+ "has APP ID " + appId + " and release UUID ." + uuid;
log.error(msg, e);
throw new LifeCycleManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "SQL Error occurred when getting the created user of a release which has APP ID " + appId
+ " and release UUID ." + uuid;
log.error(msg, e);
throw new LifeCycleManagementDAOException(msg, e);
} finally {
DAOUtil.cleanupResources(stmt, rs);
}
@ -138,12 +142,12 @@ public class GenericLifecycleStateDAOImpl extends AbstractDAOImpl implements Lif
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection when getting lifecycle states for an "
+ "application which has application ID: " + appReleaseId;
log.error(msg);
log.error(msg, e);
throw new LifeCycleManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "SQL Error occurred while retrieving lifecycle states for application which has application "
+ "ID: " + appReleaseId;
log.error(msg);
log.error(msg, e);
throw new LifeCycleManagementDAOException(msg, e);
}
return lifecycleStates;
@ -177,13 +181,13 @@ public class GenericLifecycleStateDAOImpl extends AbstractDAOImpl implements Lif
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection to add lifecycle state for application "
+ "release which has ID " + appReleaseId + ". Lifecycle state " + state.getCurrentState();
log.error(msg);
log.error(msg, e);
throw new LifeCycleManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "Error occurred while executing the query to add lifecycle state for application release which"
+ " has ID " + appReleaseId + ". Lifecycle state " + state.getCurrentState() + ". Executed query: "
+ sql;
log.error(msg);
log.error(msg, e);
throw new LifeCycleManagementDAOException(msg, e);
}
}
@ -202,12 +206,12 @@ public class GenericLifecycleStateDAOImpl extends AbstractDAOImpl implements Lif
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection to delete lifecycle states for application "
+ "release ID: " + releaseId;
log.error(msg);
log.error(msg, e);
throw new LifeCycleManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "Error occurred while executing the query to delete lifecycle states for application release"
+ " ID: " + releaseId + ". Executed query " + sql;
log.error(msg);
log.error(msg, e);
throw new LifeCycleManagementDAOException(msg, e);
}
}
@ -229,20 +233,30 @@ public class GenericLifecycleStateDAOImpl extends AbstractDAOImpl implements Lif
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection for deleting application life-cycle states "
+ "for given application Ids.";
log.error(msg);
log.error(msg, e);
throw new LifeCycleManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "Error occurred while executing query to delete application life-cycle states for given "
+ "application Ids.";
log.error(msg);
log.error(msg, e);
throw new LifeCycleManagementDAOException(msg, e);
}
}
/***
* This method is capable to construct {@link LifecycleState} object by accessing given {@link ResultSet}
* @param rs Result Set of an executed query
* @return {@link LifecycleState}
* @throws LifeCycleManagementDAOException if {@link SQLException} occurs when creating the {@link LifecycleState}
* by accessing given {@link ResultSet}. In this particular method {@link SQLException} could occurs if the
* columnLabel is not valid or if a database access error occurs or this method is called on a closed result set
*
*/
private LifecycleState constructLifecycle(ResultSet rs) throws LifeCycleManagementDAOException {
LifecycleState lifecycleState = null;
try {
if (rs !=null && rs.next()) {
LifecycleState lifecycleState = new LifecycleState();
lifecycleState = new LifecycleState();
lifecycleState.setCurrentState(rs.getString("CURRENT_STATE"));
lifecycleState.setPreviousState(rs.getString("PREVIOUS_STATE"));
lifecycleState.setUpdatedAt(rs.getTimestamp("UPDATED_AT"));
@ -250,9 +264,9 @@ public class GenericLifecycleStateDAOImpl extends AbstractDAOImpl implements Lif
}
} catch (SQLException e) {
String msg = "Error occurred while construct lifecycle state by data which is retrieved from SQL query";
log.error(msg);
log.error(msg, e);
throw new LifeCycleManagementDAOException(msg, e);
}
return null;
return lifecycleState;
}
}

@ -93,12 +93,12 @@ public class ReviewDAOImpl extends AbstractDAOImpl implements ReviewDAO {
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection to add a review for application release which"
+ " has ID: "+ appReleaseId + " and Tenant Id: " + tenantId;
log.error(msg);
log.error(msg, e);
throw new ReviewManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "Error occurred while executing SQL statement to add application review. Application ID: "
+ appReleaseId + " and tenant " + tenantId;
log.error(msg);
log.error(msg, e);
throw new ReviewManagementDAOException(msg, e);
}
}
@ -131,12 +131,12 @@ public class ReviewDAOImpl extends AbstractDAOImpl implements ReviewDAO {
} catch (DBConnectionException e) {
String msg = "Error occured while getting the database connection when checking whether user has already "
+ "commented for the application or not";
log.error(msg);
log.error(msg, e);
throw new ReviewManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "Error occured while executing the SQL statement to check whether user has already commented "
+ "for the application or not";
log.error(msg);
log.error(msg, e);
throw new ReviewManagementDAOException(msg, e);
}
}
@ -175,11 +175,11 @@ public class ReviewDAOImpl extends AbstractDAOImpl implements ReviewDAO {
}
} catch (DBConnectionException e) {
String msg = "Error occured while getting the db connection to update review for review ID: " + reviewId;
log.error(msg);
log.error(msg, e);
throw new ReviewManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "Error occurred while executing review updating query for review ID: " + reviewId;
log.error(msg);
log.error(msg, e);
throw new ReviewManagementDAOException(msg, e);
}
}
@ -215,15 +215,15 @@ public class ReviewDAOImpl extends AbstractDAOImpl implements ReviewDAO {
} catch (DBConnectionException e) {
String msg = "DB Connection Exception occurred while retrieving information of the review for review ID: "
+ reviewId;
log.error(msg);
log.error(msg, e);
throw new ReviewManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "Error occured while executing SQL statement to get review data for review ID: " + reviewId;
log.error(msg);
log.error(msg, e);
throw new ReviewManagementDAOException(msg, e);
} catch (UnexpectedServerErrorException e) {
String msg = "Found more than one review for review ID: " + reviewId;
log.error(msg);
log.error(msg, e);
throw new ReviewManagementDAOException(msg, e);
}
}
@ -267,12 +267,12 @@ public class ReviewDAOImpl extends AbstractDAOImpl implements ReviewDAO {
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection to get all app release reviews for "
+ "application release ID: " + releaseId;
log.error(msg);
log.error(msg, e);
throw new ReviewManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "Error occurred while executing the SQL statement to get all app release reviews for "
+ "application release ID: " + releaseId;
log.error(msg);
log.error(msg, e);
throw new ReviewManagementDAOException(msg, e);
}
}
@ -320,11 +320,11 @@ public class ReviewDAOImpl extends AbstractDAOImpl implements ReviewDAO {
}
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection to get all active app reviews.";
log.error(msg);
log.error(msg, e);
throw new ReviewManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "Error occurred while executing SQL to get all active app reviews.";
log.error(msg);
log.error(msg, e);
throw new ReviewManagementDAOException(msg, e);
}
}
@ -377,11 +377,11 @@ public class ReviewDAOImpl extends AbstractDAOImpl implements ReviewDAO {
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection to get all active app reviews of user "
+ username;
log.error(msg);
log.error(msg, e);
throw new ReviewManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "Error occurred while executing SQL to get all active app reviews of user " + username;
log.error(msg);
log.error(msg, e);
throw new ReviewManagementDAOException(msg, e);
}
}
@ -419,12 +419,12 @@ public class ReviewDAOImpl extends AbstractDAOImpl implements ReviewDAO {
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection when getting reply comments for a review "
+ "which has reviw ID: " + parentId;
log.error(msg);
log.error(msg, e);
throw new ReviewManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "Error occurred while executing SQL to ge reply comments for a review which has reviw ID: "
+ parentId;
log.error(msg);
log.error(msg, e);
throw new ReviewManagementDAOException(msg, e);
}
}
@ -458,12 +458,12 @@ public class ReviewDAOImpl extends AbstractDAOImpl implements ReviewDAO {
} catch (DBConnectionException e) {
String msg = "Error occured while getting DB connection to retrieve all rating values for the application "
+ "release which has UUID:" + uuid;
log.error(msg);
log.error(msg, e);
throw new ReviewManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "Error occured while executing SQL to retrieve all rating values for the application release "
+ "which has UUID:" + uuid;
log.error(msg);
log.error(msg, e);
throw new ReviewManagementDAOException(msg, e);
}
}
@ -497,11 +497,11 @@ public class ReviewDAOImpl extends AbstractDAOImpl implements ReviewDAO {
}
} catch (DBConnectionException e) {
String msg = "Error occured while getting DB connection to retrieve all rating values for an application.";
log.error(msg);
log.error(msg, e);
throw new ReviewManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "Error occured while executing SQL to get all rating values for the application.";
log.error(msg);
log.error(msg, e);
throw new ReviewManagementDAOException(msg, e);
}
}
@ -526,11 +526,11 @@ public class ReviewDAOImpl extends AbstractDAOImpl implements ReviewDAO {
} catch (DBConnectionException e) {
String msg = "Error occured while getting the database connection to delete review which has review ID: "
+ reviewId;
log.error(msg);
log.error(msg, e);
throw new ReviewManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "Error occured while executing SQL to delete review which has review ID: " + reviewId;
log.error(msg);
log.error(msg, e);
throw new ReviewManagementDAOException(msg, e);
}
}
@ -557,11 +557,11 @@ public class ReviewDAOImpl extends AbstractDAOImpl implements ReviewDAO {
}
} catch (DBConnectionException e) {
String msg = "Error occurred while getting the database connection to delete reviews for given review Ids.";
log.error(msg);
log.error(msg, e);
throw new ReviewManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "Error occurred while executing SQL to delete reviews for given review Ids.";
log.error(msg);
log.error(msg, e);
throw new ReviewManagementDAOException(msg, e);
}
}
@ -586,12 +586,12 @@ public class ReviewDAOImpl extends AbstractDAOImpl implements ReviewDAO {
} catch (DBConnectionException e) {
String msg = "Error occured while getting the database connection to delete all child comments of a review "
+ "which has ID: " + rootParentId;
log.error(msg);
log.error(msg, e);
throw new ReviewManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "Error occured while executing SQL to delete all child comments of a review which has ID: "
+ rootParentId;
log.error(msg);
log.error(msg, e);
throw new ReviewManagementDAOException(msg, e);
}
}

@ -88,12 +88,12 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc
} catch (DBConnectionException e) {
String msg = "Error occured while obtaining database connection to add device subscription for application "
+ "release which has release Id" + releaseId;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "Error occured when processing SQL to add device subscription for application release which"
+ " has release Id " + releaseId;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -144,12 +144,12 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc
String msg = "Error occurred while obtaining the DB connection to update device subscriptions of "
+ "application. Updated by: " + updateBy + " and updating action triggered from "
+ actionTriggeredFrom;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "Error occurred while executing SQL to update the device subscriptions of application. "
+ "Updated by: " + updateBy + " and updating action triggered from " + actionTriggeredFrom;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -179,12 +179,12 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc
}
} catch (DBConnectionException e) {
String msg = "Error occurred while getting database connection to add operation subscription mapping to DB";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "Error occurred while executing query to add operation subscription mapping to DB. Executed "
+ "query: " + sql;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -222,12 +222,12 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc
} catch (DBConnectionException e) {
String msg = "Error occurred while getting database connection to add user subscription. Subscribing user "
+ "is " + subscribedBy;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "Error occurred while executing query to add user subscription. Subscribing user is "
+ subscribedBy + " and executed query: " + sql;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -265,12 +265,12 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc
} catch (DBConnectionException e) {
String msg = "Error occurred while getting database connection to add role subscription. Subscribing role "
+ "is " + subscribedBy;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "Error occurred while executing query to add role subscription. Subscribing role is "
+ subscribedBy + " and executed query: " + sql;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -308,12 +308,12 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc
} catch (DBConnectionException e) {
String msg = "Error occurred while getting database connection to add group subscription. Subscribing "
+ "group is " + subscribedBy;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "Error occurred while executing query to add group subscription. Subscribing group is "
+ subscribedBy + " and executed query: " + sql;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -352,11 +352,11 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection for getting device subscription for "
+ "application Id: " + appReleaseId + ".";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "Error occurred while while running SQL to get device subscription data for application ID: " + appReleaseId;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -402,11 +402,11 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection to get device subscriptions for given device"
+ " Ids.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "SQL Error occurred while getting device subscriptions for given device Ids.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -442,11 +442,11 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection to get already subscribed users for given "
+ "user names.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "SQL Error occurred while getting subscribed users for given user names.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -482,11 +482,11 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection to getg subscribed roles for given role "
+ "names.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "SWL Error occurred while getting subscribes roles for given role names.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -522,11 +522,11 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection to get already subscribed groups for given "
+ "group names.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "SQL Error occurred while getting already subscribed groups for given group names.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -564,11 +564,11 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection to get subscribed device Ids for given "
+ "device Id list.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "SQL Error occurred while getting already subscribed device ids for given device Id list.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -619,12 +619,12 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection to update the user/role/group subscriptions "
+ "of application.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "Error occurred while processing SQL to update the user/role/group subscriptions of "
+ "application.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -654,11 +654,11 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection to get app device subscription ids for given "
+ "operation.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "Error occurred when processing SQL to get app device subscription ids for given operation.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}
@ -687,12 +687,12 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection to update the subscription status of the "
+ "device subscription.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "Error occurred when processing SQL to update the subscription status of the device "
+ "subscription.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
}
}

@ -65,12 +65,12 @@ public class GenericVisibilityDAOImpl extends AbstractDAOImpl implements Visibil
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection when adding unrestricted roles for "
+ "application which has Id " + applicationId;
log.error(msg);
log.error(msg, e);
throw new VisibilityManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "Error occurred while executing query to add unrestricted roles for application which has Id "
+ applicationId + ". Executed query " + sql;
log.error(msg);
log.error(msg, e);
throw new VisibilityManagementDAOException(msg, e);
}
}
@ -101,12 +101,12 @@ public class GenericVisibilityDAOImpl extends AbstractDAOImpl implements Visibil
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection to get unrestricted roles for application "
+ "which has application Id " + applicationId;
log.error(msg);
log.error(msg, e);
throw new VisibilityManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "Error occurred while executing query to get unrestricted roles for application which has "
+ "application Id " + applicationId + ". Executed query: " + sql;
log.error(msg);
log.error(msg, e);
throw new VisibilityManagementDAOException(msg, e);
}
}
@ -137,12 +137,12 @@ public class GenericVisibilityDAOImpl extends AbstractDAOImpl implements Visibil
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection to delete unrestricted roles of an "
+ "application which has application Id " + applicationId;
log.error(msg);
log.error(msg, e);
throw new VisibilityManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "Error occurred while executing query to delete unrestricted roles of an application which has"
+ " application Id " + applicationId + ". executed query: " + sql;
log.error(msg);
log.error(msg, e);
throw new VisibilityManagementDAOException(msg, e);
}
}

@ -232,7 +232,7 @@ public class ApplicationManagerImpl implements ApplicationManager {
.add(addImageArtifacts(applicationReleaseDTO, applicationArtifact));
} catch (ResourceManagementException e) {
String msg = "Error Occured when uploading artifacts of the public app: " + publicAppWrapper.getName();
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
}
@ -240,17 +240,15 @@ public class ApplicationManagerImpl implements ApplicationManager {
return addAppDataIntoDB(applicationDTO, tenantId);
}
private void deleteApplicationArtifacts(List<String> directoryPaths) throws ApplicationManagementException {
ApplicationStorageManager applicationStorageManager = DAOUtil.getApplicationStorageManager();
try {
applicationStorageManager.deleteAllApplicationReleaseArtifacts(directoryPaths);
} catch (ApplicationStorageManagementException e) {
String errorLog = "Error occurred when deleting application artifacts. directory paths: ." + directoryPaths
String msg = "Error occurred when deleting application artifacts. directory paths: ." + directoryPaths
.toString();
log.error(errorLog);
throw new ApplicationManagementException(errorLog, e);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
}
}
@ -310,13 +308,13 @@ public class ApplicationManagerImpl implements ApplicationManager {
}
} catch (DBConnectionException e) {
String msg = "Error occurred when getting database connection for verifying app release data.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (ApplicationManagementDAOException e) {
String msg =
"Error occurred when executing the query for verifying application release existence for "
+ "the package.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} finally {
ConnectionManagerUtil.closeDBConnection();
@ -325,8 +323,8 @@ public class ApplicationManagerImpl implements ApplicationManager {
} catch (IOException e) {
String msg = "Error occurred when getting byte array of binary file. Installer name: " + applicationArtifact
.getInstallerName();
log.error(msg);
throw new ApplicationStorageManagementException(msg);
log.error(msg, e);
throw new ApplicationStorageManagementException(msg, e);
}
return applicationReleaseDTO;
}
@ -394,12 +392,12 @@ public class ApplicationManagerImpl implements ApplicationManager {
} catch (DBConnectionException e) {
String msg = "Error occurred when getting database connection for verifying application "
+ "release existing for new app hash value.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (ApplicationManagementDAOException e) {
String msg = "Error occurred when executing the query for verifying application release "
+ "existence for the new app hash value.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} finally {
ConnectionManagerUtil.closeDBConnection();
@ -411,8 +409,8 @@ public class ApplicationManagerImpl implements ApplicationManager {
} catch (IOException e) {
String msg = "Error occurred when getting byte array of binary file. Installer name: " + applicationArtifact
.getInstallerName();
log.error(msg);
throw new ApplicationStorageManagementException(msg);
log.error(msg, e);
throw new ApplicationStorageManagementException(msg, e);
}
return applicationReleaseDTO;
}
@ -586,16 +584,16 @@ public class ApplicationManagerImpl implements ApplicationManager {
} catch (DBConnectionException e) {
String msg = "Error occurred when getting database connection to get applications by filtering from "
+ "requested filter.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (UserStoreException e) {
String msg = "User-store exception while checking whether the user " + userName + " of tenant " + tenantId
+ " has the publisher permission";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (ApplicationManagementDAOException e) {
String msg = "DAO exception while getting applications for the user " + userName + " of tenant " + tenantId;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} finally {
ConnectionManagerUtil.closeDBConnection();
@ -713,7 +711,7 @@ public class ApplicationManagerImpl implements ApplicationManager {
ConnectionManagerUtil.rollbackDBTransaction();
String msg =
"Error occurred while adding lifecycle state. application name: " + applicationDTO.getName() + ".";
log.error(msg);
log.error(msg, e);
try {
applicationStorageManager.deleteAllApplicationReleaseArtifacts(
Collections.singletonList(applicationReleaseDTO.getAppHashValue()));
@ -721,15 +719,15 @@ public class ApplicationManagerImpl implements ApplicationManager {
String errorLog =
"Error occurred when deleting application artifacts. Application artifacts are tried to "
+ "delete because of lifecycle state adding issue in the application creating operation.";
log.error(errorLog);
throw new ApplicationManagementException(errorLog, e);
log.error(errorLog, ex);
throw new ApplicationManagementException(errorLog, ex);
}
throw new ApplicationManagementException(msg, e);
} catch (ApplicationManagementDAOException e) {
ConnectionManagerUtil.rollbackDBTransaction();
String msg = "Error occurred while adding application or application release. application name: "
+ applicationDTO.getName() + ".";
log.error(msg);
log.error(msg, e);
deleteApplicationArtifacts(Collections.singletonList(applicationReleaseDTO.getAppHashValue()));
throw new ApplicationManagementException(msg, e);
} catch (LifecycleManagementException e) {
@ -737,23 +735,23 @@ public class ApplicationManagerImpl implements ApplicationManager {
String msg =
"Error occurred when getting initial lifecycle state. application name: " + applicationDTO.getName()
+ ".";
log.error(msg);
log.error(msg, e);
deleteApplicationArtifacts(Collections.singletonList(applicationReleaseDTO.getAppHashValue()));
throw new ApplicationManagementException(msg, e);
} catch (DBConnectionException e) {
String msg = "Error occurred while getting database connection.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (VisibilityManagementDAOException e) {
ConnectionManagerUtil.rollbackDBTransaction();
String msg = "Error occurred while adding unrestricted roles. application name: " + applicationDTO.getName()
+ ".";
log.error(msg);
log.error(msg, e);
deleteApplicationArtifacts(Collections.singletonList(applicationReleaseDTO.getAppHashValue()));
throw new ApplicationManagementException(msg, e);
} catch (TransactionManagementException e) {
String msg = "Error occurred while disabling AutoCommit.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} finally {
ConnectionManagerUtil.closeDBConnection();
@ -802,23 +800,23 @@ public class ApplicationManagerImpl implements ApplicationManager {
} catch (TransactionManagementException e) {
String msg = "Error occurred while staring application release creating transaction for application Id: "
+ applicationId;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (DBConnectionException e) {
String msg = "Error occurred while adding application release into IoTS app management ApplicationDTO id of"
+ " the application release: " + applicationId;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (LifeCycleManagementDAOException e) {
ConnectionManagerUtil.rollbackDBTransaction();
String msg = "Error occurred while adding new application release lifecycle state to the application"
+ " release: " + applicationId;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (ApplicationManagementDAOException e) {
ConnectionManagerUtil.rollbackDBTransaction();
String msg = "Error occurred while adding new application release for application " + applicationId;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} finally {
ConnectionManagerUtil.closeDBConnection();
@ -839,11 +837,11 @@ public class ApplicationManagerImpl implements ApplicationManager {
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the database connection for getting application for the "
+ "application ID: " + applicationId;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (ApplicationManagementDAOException e) {
String msg = "Error occurred while getting application data for application ID: " + applicationId;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} finally {
ConnectionManagerUtil.closeDBConnection();
@ -859,7 +857,7 @@ public class ApplicationManagerImpl implements ApplicationManager {
return addImageArtifacts(applicationReleaseDTO, applicationArtifact);
} catch (ResourceManagementException e) {
String msg = "Error occurred while uploading application release artifacts.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
}
}
@ -883,8 +881,8 @@ public class ApplicationManagerImpl implements ApplicationManager {
} catch (DeviceManagementException e) {
String msg =
"Error occurred while getting supported device type versions for device type : " + deviceTypeName;
log.error(msg);
throw new ApplicationManagementException(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
}
}
@ -935,20 +933,20 @@ public class ApplicationManagerImpl implements ApplicationManager {
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the database connection to get application for application ID: "
+ appId;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (LifecycleManagementException e) {
String msg = "Error occurred when getting the last state of the application lifecycle flow";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (UserStoreException e) {
String msg = "User-store exception while getting application with the application id " + appId;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (ApplicationManagementDAOException e) {
String msg = "Error occured when getting, either application tags or application categories";
log.error(msg);
throw new ApplicationManagementException(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} finally {
ConnectionManagerUtil.closeDBConnection();
}
@ -993,16 +991,16 @@ public class ApplicationManagerImpl implements ApplicationManager {
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the database connection to get application for application "
+ "release UUID: " + releaseUuid;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (UserStoreException e) {
String msg = "User-store exception occurred while getting application for application release UUID " + releaseUuid;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (ApplicationManagementDAOException e) {
String msg = "Error occurred while getting dta which are related to Application.";
log.error(msg);
throw new ApplicationManagementException(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} finally {
ConnectionManagerUtil.closeDBConnection();
}
@ -1061,20 +1059,20 @@ public class ApplicationManagerImpl implements ApplicationManager {
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the database connection to get application for application "
+ "release UUID: " + releaseUuid;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (LifecycleManagementException e) {
String msg = "Error occurred when getting the last state of the application lifecycle flow";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (UserStoreException e) {
String msg = "User-store exception while getting application with the application release UUID " + releaseUuid;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (ApplicationManagementDAOException e) {
String msg = "Error occurred while getting, application data.";
log.error(msg);
throw new ApplicationManagementException(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} finally {
ConnectionManagerUtil.closeDBConnection();
}
@ -1186,29 +1184,29 @@ public class ApplicationManagerImpl implements ApplicationManager {
} catch (DBConnectionException e) {
String msg = "Error occurred while observing the database connection to delete application which has "
+ "application ID: " + applicationId;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (TransactionManagementException e) {
String msg = "Database access error is occurred when deleting application which has application ID: "
+ applicationId;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (ApplicationManagementDAOException e) {
ConnectionManagerUtil.rollbackDBTransaction();
String msg = "Error occurred when getting application data for application id: " + applicationId;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (ApplicationStorageManagementException e) {
String msg = "Error occurred when deleting application artifacts in the file system. Application id: "
+ applicationId;
log.error(msg);
throw new ApplicationManagementException(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (LifeCycleManagementDAOException e) {
ConnectionManagerUtil.rollbackDBTransaction();
String msg = "Error occured while deleting life-cycle state data of application releases of the application"
+ " which has application ID: " + applicationId;
log.error(msg);
throw new ApplicationManagementException(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} finally {
ConnectionManagerUtil.closeDBConnection();
}
@ -1241,16 +1239,16 @@ public class ApplicationManagerImpl implements ApplicationManager {
} catch (DBConnectionException e) {
String msg = "Error occurred while observing the database connection to retire an application which has "
+ "application ID:" + applicationId;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (TransactionManagementException e) {
String msg = "Database access error is occurred when retiring application which has application ID: "
+ applicationId;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (ApplicationManagementDAOException e) {
String msg = "Error occurred when getting application data for application id: " + applicationId;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} finally {
ConnectionManagerUtil.closeDBConnection();
@ -1295,25 +1293,27 @@ public class ApplicationManagerImpl implements ApplicationManager {
} catch (DBConnectionException e) {
String msg = "Error occurred while observing the database connection to delete application release which "
+ "has UUID:" + releaseUuid;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (TransactionManagementException e) {
String msg = "Database access error is occurred when deleting application release which has UUID: "
+ releaseUuid;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (ApplicationManagementDAOException e) {
ConnectionManagerUtil.rollbackDBTransaction();
String msg = "Error occurred when application release data for application release UUID: " + releaseUuid;
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (ApplicationStorageManagementException e) {
String msg = "Error occurred when deleting the application release artifact from the file system. "
+ "Application release UUID: " + releaseUuid;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (LifeCycleManagementDAOException e) {
ConnectionManagerUtil.rollbackDBTransaction();
String msg = "Error occurred when dleting lifecycle data for application release UUID: " + releaseUuid;
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} finally {
ConnectionManagerUtil.closeDBConnection();
@ -1326,7 +1326,6 @@ public class ApplicationManagerImpl implements ApplicationManager {
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true);
ApplicationReleaseDTO applicationReleaseDTO;
try {
ConnectionManagerUtil.beginDBTransaction();
applicationReleaseDTO = this.applicationReleaseDAO.getReleaseByUUID(uuid, tenantId);
if (applicationReleaseDTO == null) {
@ -1356,24 +1355,24 @@ public class ApplicationManagerImpl implements ApplicationManager {
String msg =
"Error occured when getting DB connection to update image artifacts of the application release "
+ "which has uuid " + uuid;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (TransactionManagementException e) {
String msg = "Database access error is occurred when updating application release image artifacts which has "
+ "UUID: " + uuid;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
}catch (ApplicationManagementDAOException e) {
ConnectionManagerUtil.rollbackDBTransaction();
String msg =
"Error occured while getting application release data for updating image artifacts of the application release uuid "
+ uuid + ".";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (ResourceManagementException e) {
ConnectionManagerUtil.rollbackDBTransaction();
String msg = "Error occured while updating image artifacts of the application release uuid " + uuid + ".";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg , e);
} finally {
ConnectionManagerUtil.closeDBConnection();
@ -1403,7 +1402,7 @@ public class ApplicationManagerImpl implements ApplicationManager {
}
} catch (DeviceManagementException e) {
String msg = "Error occured while getting supported device types in IoTS";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
}
@ -1445,26 +1444,27 @@ public class ApplicationManagerImpl implements ApplicationManager {
} catch (ApplicationManagementDAOException e) {
ConnectionManagerUtil.rollbackDBTransaction();
String msg = "Error occured while getting/updating APPM DB for updating application Installer.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (TransactionManagementException e) {
String msg = "Error occured while starting the transaction to update application release artifact which has "
+ "application uuid " + releaseUuid + ".";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (DBConnectionException e) {
String msg = "Error occured when getting DB connection to update application release artifact of the "
+ "application release uuid " + releaseUuid + ".";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (ApplicationStorageManagementException e) {
ConnectionManagerUtil.rollbackDBTransaction();
throw new ApplicationManagementException("In order to update the artifact, couldn't find it in the system",
e);
String msg = "In order to update the artifact, couldn't find it in the system";
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (ResourceManagementException e) {
ConnectionManagerUtil.rollbackDBTransaction();
String msg = "Error occured when updating application installer.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} finally {
ConnectionManagerUtil.closeDBConnection();
@ -1487,16 +1487,16 @@ public class ApplicationManagerImpl implements ApplicationManager {
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the database connection to get lifecycle state change flow for "
+ "application release which has UUID: " + releaseUuid;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (LifeCycleManagementDAOException e) {
String msg = "Failed to get lifecycle state for application release uuid " + releaseUuid;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (ApplicationManagementDAOException e) {
String msg =
"Error occurred while getting application release for application release UUID: " + releaseUuid;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} finally {
ConnectionManagerUtil.closeDBConnection();
@ -1560,24 +1560,24 @@ public class ApplicationManagerImpl implements ApplicationManager {
} catch (DBConnectionException e) {
String msg = "Error occurred while getting the database connection to change lifecycle state of the "
+ "application release which has UUID:" + releaseUuid;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (TransactionManagementException e) {
String msg = "Database access error is occurred when changing lifecycle state of application release which "
+ "has UUID: " + releaseUuid;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
}catch (LifeCycleManagementDAOException e) {
ConnectionManagerUtil.rollbackDBTransaction();
String msg = "Failed to add lifecycle state for Application release UUID: " + releaseUuid;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (ApplicationManagementDAOException e) {
ConnectionManagerUtil.rollbackDBTransaction();
String msg = "Error occurred when accessing application release data of application release which has the "
+ "application release UUID: " + releaseUuid;
log.error(msg);
throw new ApplicationManagementException(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} finally {
ConnectionManagerUtil.closeDBConnection();
}
@ -1598,16 +1598,16 @@ public class ApplicationManagerImpl implements ApplicationManager {
ConnectionManagerUtil.commitDBTransaction();
} catch (DBConnectionException e) {
String msg = "Error occurred while getting the database connection to add application categories.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (TransactionManagementException e) {
String msg = "Database access error is occurred when adding application categories.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (ApplicationManagementDAOException e) {
ConnectionManagerUtil.rollbackDBTransaction();
String msg = "Error occured when getting existing categories or when inserting new application categories.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} finally {
ConnectionManagerUtil.closeDBConnection();
@ -1763,27 +1763,28 @@ public class ApplicationManagerImpl implements ApplicationManager {
ConnectionManagerUtil.rollbackDBTransaction();
String msg = "Error occurred while checking whether logged in user is ADMIN or not when updating "
+ "application of application id: " + applicationId;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (ApplicationManagementDAOException e) {
ConnectionManagerUtil.rollbackDBTransaction();
String msg = "Error occurred while updating the application, application id: " + applicationId;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (VisibilityManagementDAOException e) {
ConnectionManagerUtil.rollbackDBTransaction();
String msg = "Error occurred while updating the visibility restriction of the application. Application id: "
+ applicationId;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (TransactionManagementException e) {
String msg = "Error occurred while starting database transaction for application updating. Application id: "
+ applicationId;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (DBConnectionException e) {
String msg = "Error occurred while getting database connection for application updating. Application id: "
+ applicationId;
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} finally {
ConnectionManagerUtil.closeDBConnection();
@ -1809,11 +1810,11 @@ public class ApplicationManagerImpl implements ApplicationManager {
return responseTagList;
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the database connection to get registered tags";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (ApplicationManagementDAOException e) {
String msg = "Error occurred when getting registered tags from the system.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} finally {
ConnectionManagerUtil.closeDBConnection();
@ -1839,11 +1840,11 @@ public class ApplicationManagerImpl implements ApplicationManager {
return responseCategoryList;
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the database connection to get registered categories.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (ApplicationManagementDAOException e) {
String msg = "Error occurred when getting registered tags from the system.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} finally {
ConnectionManagerUtil.closeDBConnection();
@ -1872,15 +1873,15 @@ public class ApplicationManagerImpl implements ApplicationManager {
}
} catch (DBConnectionException e) {
String msg = "Error occurred while getting the database connection to delete application tag.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (TransactionManagementException e) {
String msg = "Database access error is occurred when deleting application tag.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (ApplicationManagementDAOException e) {
String msg = "Error occurred when getting tag Id or deleting tag mapping from the system.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} finally {
ConnectionManagerUtil.closeDBConnection();
@ -1905,15 +1906,15 @@ public class ApplicationManagerImpl implements ApplicationManager {
ConnectionManagerUtil.commitDBTransaction();
} catch (DBConnectionException e) {
String msg = "Error occurred while getting the database connection to delete registered tag.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (TransactionManagementException e) {
String msg = "Database access error is occurred when deleting registered tag.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (ApplicationManagementDAOException e) {
String msg = "Error occurred when getting tag Id or deleting the tag from the system.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} finally {
ConnectionManagerUtil.closeDBConnection();
@ -1942,15 +1943,15 @@ public class ApplicationManagerImpl implements ApplicationManager {
ConnectionManagerUtil.commitDBTransaction();
} catch (DBConnectionException e) {
String msg = "Error occurred while getting the database connection to delete unused tag.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (TransactionManagementException e) {
String msg = "Database access error is occurred when deleting unused tag.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (ApplicationManagementDAOException e) {
String msg = "Error occurred when getting tag Ids or deleting the tag from the system.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} finally {
ConnectionManagerUtil.closeDBConnection();
@ -1974,7 +1975,6 @@ public class ApplicationManagerImpl implements ApplicationManager {
+ oldTagName + " to new tag name " + newTagName;
log.error(msg);
throw new BadRequestException(msg);
}
TagDTO tag = applicationDAO.getTagForTagName(oldTagName, tenantId);
if (tag == null){
@ -1987,15 +1987,15 @@ public class ApplicationManagerImpl implements ApplicationManager {
ConnectionManagerUtil.commitDBTransaction();
} catch (DBConnectionException e) {
String msg = "Error occurred while getting the database connection to update application tag.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (TransactionManagementException e) {
String msg = "Database access error is occurred when updating application tag.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (ApplicationManagementDAOException e) {
String msg = "Error occurred when getting tag Ids or deleting the tag from the system.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} finally {
ConnectionManagerUtil.closeDBConnection();
@ -2029,16 +2029,16 @@ public class ApplicationManagerImpl implements ApplicationManager {
}
} catch (DBConnectionException e) {
String msg = "Error occurred while getting the database connection to add tags.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (TransactionManagementException e) {
String msg = "Database access error is occurred when adding tags.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (ApplicationManagementDAOException e) {
ConnectionManagerUtil.rollbackDBTransaction();
String msg = "Error occurred either getting registered tags or adding new tags.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} finally {
ConnectionManagerUtil.closeDBConnection();
@ -2081,16 +2081,16 @@ public class ApplicationManagerImpl implements ApplicationManager {
}
} catch (DBConnectionException e) {
String msg = "Error occurred while getting the database connection to add application tags.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (TransactionManagementException e) {
String msg = "Database access error is occurred when adding application tags.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (ApplicationManagementDAOException e) {
ConnectionManagerUtil.rollbackDBTransaction();
String msg = "Error occurred while accessing application tags. Application ID: " + appId;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} finally {
ConnectionManagerUtil.closeDBConnection();
@ -2124,16 +2124,16 @@ public class ApplicationManagerImpl implements ApplicationManager {
}
} catch (DBConnectionException e) {
String msg = "Error occurred while getting the database connection to add categories.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (TransactionManagementException e) {
String msg = "Database access error is occurred when adding categories.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (ApplicationManagementDAOException e) {
ConnectionManagerUtil.rollbackDBTransaction();
String msg = "Error occurred either getting registered categories or adding new categories.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} finally {
ConnectionManagerUtil.closeDBConnection();
@ -2161,15 +2161,15 @@ public class ApplicationManagerImpl implements ApplicationManager {
ConnectionManagerUtil.commitDBTransaction();
} catch (DBConnectionException e) {
String msg = "Error occurred while getting the database connection to delete category.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (TransactionManagementException e) {
String msg = "Database access error is occurred when deleting category.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (ApplicationManagementDAOException e) {
String msg = "Error occurred when getting category Id or deleting the category from the system.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} finally {
ConnectionManagerUtil.closeDBConnection();
@ -2192,15 +2192,15 @@ public class ApplicationManagerImpl implements ApplicationManager {
ConnectionManagerUtil.commitDBTransaction();
} catch (DBConnectionException e) {
String msg = "Error occurred while getting the database connection to update category.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (TransactionManagementException e) {
String msg = "Database access error is occurred when updating categiry.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (ApplicationManagementDAOException e) {
String msg = "Error occurred when getting tag Ids or deleting the category from the system.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} finally {
ConnectionManagerUtil.closeDBConnection();
@ -2338,22 +2338,22 @@ public class ApplicationManagerImpl implements ApplicationManager {
} catch (DBConnectionException e) {
String msg = "Error occurred while getting the database connection to update enterprise app release which "
+ "has release UUID: " + releaseUuid;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (TransactionManagementException e) {
String msg = "Database access error is occurred when updating enterprise app release which has release UUID: "
+ releaseUuid;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (ApplicationManagementDAOException e) {
ConnectionManagerUtil.rollbackDBTransaction();
String msg = "Error occured when updating Ent Application release of UUID: " + releaseUuid;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (ResourceManagementException e) {
String msg = "Error occured when updating application release artifact in the file system. Ent App release "
+ "UUID:" + releaseUuid;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} finally {
ConnectionManagerUtil.closeDBConnection();
@ -2406,22 +2406,22 @@ public class ApplicationManagerImpl implements ApplicationManager {
} catch (DBConnectionException e) {
String msg = "Error occurred while getting the database connection to update public app release which "
+ "has release UUID: " + releaseUuid;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (TransactionManagementException e) {
String msg = "Database access error is occurred when updating public app release which has release UUID:."
+ releaseUuid;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (ApplicationManagementDAOException e) {
ConnectionManagerUtil.rollbackDBTransaction();
String msg = "Error occured when updating public app release of UUID: " + releaseUuid;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (ResourceManagementException e) {
String msg = "Error occured when updating public app release artifact in the file system. Public app "
+ "release UUID:" + releaseUuid;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} finally {
ConnectionManagerUtil.closeDBConnection();
@ -2470,30 +2470,30 @@ public class ApplicationManagerImpl implements ApplicationManager {
} catch (DBConnectionException e) {
String msg = "Error occurred while getting the database connection to update web app release which "
+ "has release UUID: " + releaseUuid;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (TransactionManagementException e) {
String msg = "Database access error is occurred when updating web app release which has release UUID:."
+ releaseUuid;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (ApplicationManagementDAOException e) {
ConnectionManagerUtil.rollbackDBTransaction();
String msg = "Error occured when updating web app release for web app Release UUID: " + releaseUuid;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (ResourceManagementException e) {
String msg = "Error occured when updating web app release artifact in the file system. Web app "
+ "release UUID:" + releaseUuid;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} finally {
ConnectionManagerUtil.closeDBConnection();
}
}
private void validateAppReleaseUpdating(ApplicationDTO applicationDTO, String appType) throws ApplicationManagementException {
private void validateAppReleaseUpdating(ApplicationDTO applicationDTO, String appType)
throws ApplicationManagementException {
if (applicationDTO == null) {
String msg = "Couldn't found an application for requested UUID.";
log.error(msg);
@ -2721,16 +2721,16 @@ public class ApplicationManagerImpl implements ApplicationManager {
}
} catch (DBConnectionException e) {
String msg = "Error occurred while getting database connection.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (ApplicationManagementDAOException e) {
String msg =
"Error occurred while getting data which is related to web clip. web clip name: " + appName + ".";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (UserStoreException e) {
String msg = "Error occurred when validating the unrestricted roles given for the web clip";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} finally {
ConnectionManagerUtil.closeDBConnection();
@ -2843,16 +2843,16 @@ public class ApplicationManagerImpl implements ApplicationManager {
ConnectionManagerUtil.commitDBTransaction();
} catch (ApplicationManagementDAOException e) {
String msg = "Error occured while updating app subscription status of the device.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (DBConnectionException e) {
String msg = "Error occurred while obersving the database connection to update aoo subscription status of "
+ "device.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (TransactionManagementException e) {
String msg = "Error occurred while executing database transaction";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} finally {
ConnectionManagerUtil.closeDBConnection();
@ -2893,11 +2893,11 @@ public class ApplicationManagerImpl implements ApplicationManager {
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the database connection for getting application for the release UUID: "
+ releaseUuid;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (ApplicationManagementDAOException e) {
String msg = "Error occurred while getting application data for release UUID: " + releaseUuid;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} finally {
ConnectionManagerUtil.closeDBConnection();

@ -109,7 +109,7 @@ public class ApplicationStorageManagerImpl implements ApplicationStorageManager
} catch (IOException e) {
String msg = "IO Exception occurred while saving application artifacts for the application which has UUID "
+ applicationReleaseDTO.getUuid();
log.error(msg);
log.error(msg, e);
throw new ApplicationStorageManagementException(msg, e);
}
}
@ -136,8 +136,8 @@ public class ApplicationStorageManagerImpl implements ApplicationStorageManager
}
} catch (ParsingException e){
String msg = "Application Type doesn't match with supporting application types " + deviceType;
log.error(msg);
throw new ApplicationStorageManagementException(msg);
log.error(msg, e);
throw new ApplicationStorageManagementException(msg, e);
}
return applicationInstaller;
}
@ -158,7 +158,7 @@ public class ApplicationStorageManagerImpl implements ApplicationStorageManager
} catch (IOException e) {
String msg = "IO Exception while saving the release artifacts in the server for the application UUID "
+ applicationReleaseDTO.getUuid();
log.error(msg);
log.error(msg, e);
throw new ApplicationStorageManagementException( msg, e);
}
return applicationReleaseDTO;
@ -213,7 +213,7 @@ public class ApplicationStorageManagerImpl implements ApplicationStorageManager
deleteAppReleaseArtifact( storagePath + deletingAppHashValue);
} catch (IOException e) {
String msg = "Application installer updating is failed because of I/O issue";
log.error(msg);
log.error(msg, e);
throw new ApplicationStorageManagementException(msg, e);
}
}
@ -243,6 +243,7 @@ public class ApplicationStorageManagerImpl implements ApplicationStorageManager
return StorageManagementUtil.getInputStream(filePath);
} catch (IOException e) {
String msg = "Error occured when accessing the file in file path: " + filePath;
log.error(msg, e);
throw new ApplicationStorageManagementException(msg, e);
}
}

@ -35,7 +35,6 @@ import org.wso2.carbon.device.application.mgt.core.exception.NotFoundException;
import org.wso2.carbon.device.application.mgt.core.internal.DataHolder;
import org.wso2.carbon.device.application.mgt.core.lifecycle.LifecycleStateManager;
import org.wso2.carbon.device.application.mgt.core.util.ConnectionManagerUtil;
import org.wso2.carbon.device.application.mgt.core.util.Constants;
import java.io.InputStream;
import java.util.Map;
@ -46,12 +45,9 @@ public class AppmDataHandlerImpl implements AppmDataHandler {
private UIConfiguration uiConfiguration;
private LifecycleStateManager lifecycleStateManager;
public AppmDataHandlerImpl(UIConfiguration config) {
this.uiConfiguration = config;
lifecycleStateManager = DataHolder.getInstance().getLifecycleStateManager();
}
@Override
@ -90,15 +86,14 @@ public class AppmDataHandlerImpl implements AppmDataHandler {
String msg =
"Error occurred when retrieving application release hash value for given application release UUID: "
+ uuid;
log.error(msg);
throw new ApplicationManagementException(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (ApplicationStorageManagementException e) {
String msg = "Error occurred when getting input stream of the " + artifactName + " file.";
log.error(msg);
throw new ApplicationManagementException(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} finally {
ConnectionManagerUtil.closeDBConnection();
}
}
}

@ -141,22 +141,22 @@ public class ReviewManagerImpl implements ReviewManager {
} catch (DBConnectionException e) {
String msg = "DB Connection error occurs when adding Review for application release with UUID: " + uuid
+ " is failed";
log.error(msg);
log.error(msg, e);
throw new ReviewManagementException(msg, e);
} catch (TransactionManagementException e) {
String msg = "DB transaction error occurred when adding review for application release which has "
+ "application UUID: " + uuid;
log.error(msg);
log.error(msg, e);
throw new ReviewManagementException(msg, e);
} catch (ApplicationManagementDAOException e) {
String msg = "Error occurred when getting application release data for application release UUID:." + uuid;
log.error(msg);
log.error(msg, e);
throw new ReviewManagementException(msg, e);
} catch (ReviewManagementDAOException e) {
ConnectionManagerUtil.rollbackDBTransaction();
String msg = "Error occurred when getting review data or adding review data for application release which "
+ "has UUID: " + uuid;
log.error(msg);
log.error(msg, e);
throw new ReviewManagementException(msg, e);
} finally {
ConnectionManagerUtil.closeDBConnection();
@ -212,39 +212,42 @@ public class ReviewManagerImpl implements ReviewManager {
ConnectionManagerUtil.rollbackDBTransaction();
return false;
} catch (DBConnectionException e) {
throw new ReviewManagementException(
"DB Connection error occurs ,Review for application release with UUID: " + uuid + " is failed", e);
String msg = "DB Connection error occurred while adding reply comment for app review of application release"
+ " which has UUID: " + uuid + " and review Id " + parentReviewId;
log.error(msg, e);
throw new ReviewManagementException(msg, e);
} catch (TransactionManagementException e) {
String msg = "DB transaction error occurred when adding reply comment for comment which has comment id: "
+ parentReviewId;
log.error(msg);
log.error(msg, e);
throw new ReviewManagementException(msg, e);
} catch (ApplicationManagementDAOException e) {
ConnectionManagerUtil.rollbackDBTransaction();
throw new ReviewManagementException(
"Error occured while verifying whether application release is exists or not.", e);
String msg = "Error occured while verifying whether application release is exists or not for UUID " + uuid;
log.error(msg, e);
throw new ReviewManagementException(msg, e);
} finally {
ConnectionManagerUtil.closeDBConnection();
}
}
private ReviewDTO reviewWrapperToDTO(ReviewWrapper reviewWrapper){
private ReviewDTO reviewWrapperToDTO(ReviewWrapper reviewWrapper) {
ReviewDTO reviewDTO = new ReviewDTO();
reviewDTO.setContent(reviewWrapper.getContent());
reviewDTO.setRating(reviewWrapper.getRating());
return reviewDTO;
}
private List<Review> reviewDTOToReview(List<ReviewDTO> reviewDTOs){
private List<Review> reviewDTOToReview(List<ReviewDTO> reviewDTOs) {
List<Review> reviews = new ArrayList<>();
for (ReviewDTO reviewDTO : reviewDTOs){
for (ReviewDTO reviewDTO : reviewDTOs) {
reviews.add(reviewDTOToReview(reviewDTO));
}
return reviews;
}
private Review reviewDTOToReview(ReviewDTO reviewDTO){
private Review reviewDTOToReview(ReviewDTO reviewDTO) {
Review review = new Review();
review.setId(reviewDTO.getId());
review.setContent(reviewDTO.getContent());
@ -264,7 +267,7 @@ public class ReviewManagerImpl implements ReviewManager {
return this.reviewDAO.getReview(reviewId, tenantId);
} catch (DBConnectionException e) {
String msg = "DB Connection error occurs updating reviewTmp with reviewTmp id " + reviewId + ".";
log.error(msg);
log.error(msg, e);
throw new ReviewManagementException(msg, e);
} finally {
ConnectionManagerUtil.closeDBConnection();
@ -343,8 +346,8 @@ public class ReviewManagerImpl implements ReviewManager {
}
}
private ReviewDTO updateReviewInDB(ReviewDTO reviewDTO, int reviewId, boolean isActiveReview,
int tenantId) throws ReviewManagementException, ApplicationManagementException {
private ReviewDTO updateReviewInDB(ReviewDTO reviewDTO, int reviewId, boolean isActiveReview, int tenantId)
throws ReviewManagementException, ApplicationManagementException {
try {
ConnectionManagerUtil.beginDBTransaction();
ReviewDTO updatedReviewDTO = this.reviewDAO.updateReview(reviewDTO, reviewId, isActiveReview, tenantId);
@ -357,15 +360,15 @@ public class ReviewManagerImpl implements ReviewManager {
} catch (ReviewManagementDAOException e) {
ConnectionManagerUtil.rollbackDBTransaction();
String msg = "Error occured while getting reviewTmp with reviewTmp id " + reviewId + ".";
log.error(msg);
log.error(msg, e);
throw new ReviewManagementException(msg, e);
} catch (DBConnectionException e) {
String msg = "DB Connection error occurs updating reviewTmp with reviewTmp id " + reviewId + ".";
log.error(msg);
log.error(msg, e);
throw new ReviewManagementException(msg, e);
} catch (TransactionManagementException e) {
String msg = "DB transaction error occurred when updating comment which has comment id: " + reviewId;
log.error(msg);
log.error(msg, e);
throw new ReviewManagementException(msg, e);
} finally {
ConnectionManagerUtil.closeDBConnection();
@ -382,20 +385,25 @@ public class ReviewManagerImpl implements ReviewManager {
try {
ConnectionManagerUtil.openDBConnection();
ApplicationReleaseDTO releaseDTO = this.applicationReleaseDAO.getReleaseByUUID(uuid, tenantId);
if (releaseDTO == null){
if (releaseDTO == null) {
String msg = "Couldn't found an application release for UUID: " + uuid;
log.error(msg);
throw new NotFoundException(msg);
}
return getReviewTree(this.reviewDAO.getAllReleaseReviews(releaseDTO.getId(), request, tenantId));
} catch (ReviewManagementDAOException e) {
throw new ReviewManagementException("Error occured while getting all reviews for application uuid: " + uuid,
e);
String msg = "Error occured while getting all reviews for application uuid: " + uuid;
log.error(msg, e);
throw new ReviewManagementException(msg, e);
} catch (DBConnectionException e) {
throw new ReviewManagementException("Error occured while getting the DB connection.", e);
String msg ="Error occured while getting the DB connection to get all reviews for application release which"
+ " has UUID " + uuid;
log.error(msg, e);
throw new ReviewManagementException(msg, e);
} catch (ApplicationManagementDAOException e) {
String msg = "Error occurred while getting application release details for application release UUId " + uuid;
log.error(msg);
String msg =
"Error occurred while getting application release details for application release UUId " + uuid;
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} finally {
ConnectionManagerUtil.closeDBConnection();
@ -416,11 +424,11 @@ public class ReviewManagerImpl implements ReviewManager {
} catch (ReviewManagementDAOException e) {
String msg = "Error occured while getting all reviews for application which has an "
+ "application release of uuid: " + uuid;
log.error(msg);
log.error(msg, e);
throw new ReviewManagementException(msg, e);
} catch (DBConnectionException e) {
String msg = "Error occured while getting the DB connection to get app app reviews.";
log.error(msg);
log.error(msg, e);
throw new ReviewManagementException(msg, e);
} finally {
ConnectionManagerUtil.closeDBConnection();
@ -441,18 +449,23 @@ public class ReviewManagerImpl implements ReviewManager {
List<ReviewDTO> reviewDtos = this.reviewDAO
.getAllActiveAppReviewsOfUser(applicationReleaseIds, request, username, tenantId);
if (!reviewDtos.isEmpty() && reviewDtos.size() > 1) {
String msg = "User " + username + " can't have more than active application review for application which"
String msg =
"User " + username + " can't have more than active application review for application which"
+ " has application release of UUID: " + uuid;
log.error(msg);
throw new ApplicationManagementException(msg);
}
return getReviewTree(reviewDtos);
} catch (ReviewManagementDAOException e) {
throw new ReviewManagementException("Error occured while getting all reviews for application which has an "
+ "application release of uuid: " + uuid,
e);
String msg = "Error occured while getting all " + username + "'s reviews for application which has an "
+ "application release of uuid: " + uuid;
log.error(msg, e);
throw new ReviewManagementException(msg, e);
} catch (DBConnectionException e) {
throw new ReviewManagementException("Error occured while getting the DB connection.", e);
String msg = "Error occured while getting DB connection to get all " + username + "'s reviews for "
+ "application which has an application release of uuid: " + uuid;
log.error(msg, e);
throw new ReviewManagementException(msg, e);
} finally {
ConnectionManagerUtil.closeDBConnection();
}
@ -471,14 +484,15 @@ public class ReviewManagerImpl implements ReviewManager {
return applicationDTO.getApplicationReleaseDTOs().stream().map(ApplicationReleaseDTO::getId)
.collect(Collectors.toList());
} catch (DBConnectionException e) {
String msg = "Error occured while getting the DB connection to get application which has application release"
String msg =
"Error occured while getting the DB connection to get application which has application release"
+ " of UUID: " + uuid;
log.error(msg);
log.error(msg, e);
throw new ReviewManagementException(msg, e);
} catch (ApplicationManagementDAOException e) {
String msg = "Error occurred while getting application release details for application which has an "
+ "application release of UUID " + uuid;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} finally {
ConnectionManagerUtil.closeDBConnection();
@ -511,13 +525,14 @@ public class ReviewManagerImpl implements ReviewManager {
paginationResult.setRecordsTotal(numOfReviews);
return paginationResult;
} catch (ReviewManagementDAOException e) {
throw new ReviewManagementException("Error occured while getting all reply comments for given review list",
e);
String msg = "Error occured while getting all reply comments for given review list";
log.error(msg, e);
throw new ReviewManagementException(msg, e);
}
}
private ReviewNode<ReviewDTO> findAndSetChild(ReviewNode<ReviewDTO> node, ReviewDTO reviewDTO) {
if (node.getData().getId() == reviewDTO.getImmediateParentId()){
if (node.getData().getId() == reviewDTO.getImmediateParentId()) {
ReviewNode<ReviewDTO> childNode = new ReviewNode<>(reviewDTO);
node.addChild(childNode);
return node;
@ -530,10 +545,10 @@ public class ReviewManagerImpl implements ReviewManager {
private Review constructReviewResponse(Review parentReview, ReviewNode<ReviewDTO> node) {
Review review = reviewDTOToReview(node.getData());
if (parentReview != null){
if (parentReview != null) {
parentReview.getReplies().add(review);
}
if (node.getChildren().isEmpty()){
if (node.getChildren().isEmpty()) {
return review;
}
for (ReviewNode<ReviewDTO> reviewDTOReviewNode : node.getChildren()) {
@ -558,7 +573,7 @@ public class ReviewManagerImpl implements ReviewManager {
private List<Integer> getDeletingReviewIds(ReviewNode<ReviewDTO> node, List<Integer> reviewIds) {
reviewIds.add(node.getData().getId());
if (node.getChildren().isEmpty()){
if (node.getChildren().isEmpty()) {
return reviewIds;
}
for (ReviewNode<ReviewDTO> each : node.getChildren()) {
@ -567,8 +582,7 @@ public class ReviewManagerImpl implements ReviewManager {
return reviewIds;
}
@Override
public void deleteReview(String uuid, int reviewId, boolean isPriviledgedUser)
@Override public void deleteReview(String uuid, int reviewId, boolean isPriviledgedUser)
throws ReviewManagementException, ApplicationManagementException {
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true);
String username = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername();
@ -580,7 +594,7 @@ public class ReviewManagerImpl implements ReviewManager {
log.error(msg);
throw new NotFoundException(msg);
}
if (!existingReview.getReleaseUuid().equals(uuid)){
if (!existingReview.getReleaseUuid().equals(uuid)) {
String msg = "You are trying to delete a review which is not associated with application release which "
+ "has UUID: " + uuid;
log.error(msg);
@ -616,31 +630,30 @@ public class ReviewManagerImpl implements ReviewManager {
}
} catch (DBConnectionException e) {
String msg = "DB Connection error occurs deleting review with review id " + reviewId + ".";
log.error(msg);
log.error(msg, e);
throw new ReviewManagementException(msg, e);
} catch (ReviewManagementDAOException e) {
ConnectionManagerUtil.rollbackDBTransaction();
String msg = "Error occured while deleting review with review id " + reviewId + ".";
log.error(msg);
log.error(msg, e);
throw new ReviewManagementException(msg, e);
} catch (TransactionManagementException e) {
String msg = "Error occurred when handleing transaction to delete application reviews.";
log.error(msg);
log.error(msg, e);
throw new ReviewManagementException(msg, e);
} finally {
ConnectionManagerUtil.closeDBConnection();
}
}
@Override
public Rating getAppReleaseRating(String appReleaseUuid) throws ReviewManagementException, ApplicationManagementException {
@Override public Rating getAppReleaseRating(String appReleaseUuid)
throws ReviewManagementException, ApplicationManagementException {
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true);
try {
ConnectionManagerUtil.openDBConnection();
Rating rating = this.applicationReleaseDAO.getReleaseRating(appReleaseUuid, tenantId);
if (rating == null) {
throw new NotFoundException(
"Couldn't find rating for application release UUID: " + appReleaseUuid
throw new NotFoundException("Couldn't find rating for application release UUID: " + appReleaseUuid
+ ". Please check the existence of the application release");
}
@ -648,24 +661,27 @@ public class ReviewManagerImpl implements ReviewManager {
rating.setRatingVariety(constructRatingVariety(ratingValues));
return rating;
} catch (ApplicationManagementDAOException e) {
throw new ReviewManagementException(
"Error occured while getting the rating value of the application release uuid: " + appReleaseUuid,
e);
String msg =
"Error occured while getting the rating value of the application release uuid: " + appReleaseUuid;
log.error(msg, e);
throw new ReviewManagementException(msg, e);
} catch (DBConnectionException e) {
throw new ReviewManagementException(
"DB Connection error occured while getting the rating value of the application release uuid: "
+ appReleaseUuid, e);
String msg = "DB Connection error occured while getting the rating value of the application release uuid: "
+ appReleaseUuid;
log.error(msg, e);
throw new ReviewManagementException(msg, e);
} catch (ReviewManagementDAOException e) {
throw new ReviewManagementException(
"Error occured while getting all rating values for the application release UUID: "
+ appReleaseUuid, e);
String msg = "Error occured while getting all rating values for the application release UUID: "
+ appReleaseUuid;
log.error(msg, e);
throw new ReviewManagementException(msg, e);
} finally {
ConnectionManagerUtil.closeDBConnection();
}
}
@Override
public Rating getAppRating(String appReleaseUuid) throws ReviewManagementException, ApplicationManagementException {
@Override public Rating getAppRating(String appReleaseUuid)
throws ReviewManagementException, ApplicationManagementException {
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true);
try {
ConnectionManagerUtil.openDBConnection();
@ -686,18 +702,21 @@ public class ReviewManagerImpl implements ReviewManager {
rating.setRatingVariety(constructRatingVariety(ratingValues));
return rating;
} catch (DBConnectionException e) {
String msg = "DB Connection error occured while getting app rating of the application which has application "
String msg =
"DB Connection error occured while getting app rating of the application which has application "
+ "release for uuid: " + appReleaseUuid;
log.error(msg);
log.error(msg, e);
throw new ReviewManagementException(msg, e);
}catch (ApplicationManagementDAOException e) {
String msg = "Error occured while getting the application DTO for the application release uuid: " + appReleaseUuid;
log.error(msg);
} catch (ApplicationManagementDAOException e) {
String msg = "Error occured while getting the application DTO for the application release uuid: "
+ appReleaseUuid;
log.error(msg, e);
throw new ReviewManagementException(msg, e);
} catch (ReviewManagementDAOException e) {
String msg ="Error occured while getting all rating values of application which has the application release "
String msg =
"Error occured while getting all rating values of application which has the application release "
+ "for UUID: " + appReleaseUuid;
log.error(msg);
log.error(msg, e);
throw new ReviewManagementException(msg, e);
} finally {
ConnectionManagerUtil.closeDBConnection();
@ -781,7 +800,7 @@ public class ReviewManagerImpl implements ReviewManager {
this.applicationDAO.updateApplicationRating(uuid, appAverageRatingValue, tenantId);
} catch (ApplicationManagementDAOException e) {
String msg = "Error occurred when getting application data or updating application rating value.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (ReviewManagementDAOException e) {
String msg = "Error occurred when getting application rating values";

@ -27,7 +27,6 @@ import org.wso2.carbon.device.application.mgt.common.DeviceTypes;
import org.wso2.carbon.device.application.mgt.common.SubAction;
import org.wso2.carbon.device.application.mgt.common.SubsciptionType;
import org.wso2.carbon.device.application.mgt.common.SubscribingDeviceIdHolder;
import org.wso2.carbon.device.application.mgt.common.config.MDMConfig;
import org.wso2.carbon.device.application.mgt.common.dto.ApplicationDTO;
import org.wso2.carbon.device.application.mgt.common.dto.DeviceSubscriptionDTO;
import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagementException;
@ -36,7 +35,6 @@ import org.wso2.carbon.device.application.mgt.common.exception.LifecycleManageme
import org.wso2.carbon.device.application.mgt.common.exception.TransactionManagementException;
import org.wso2.carbon.device.application.mgt.common.response.Application;
import org.wso2.carbon.device.application.mgt.common.services.SubscriptionManager;
import org.wso2.carbon.device.application.mgt.core.config.ConfigurationManager;
import org.wso2.carbon.device.application.mgt.core.dao.ApplicationDAO;
import org.wso2.carbon.device.application.mgt.core.dao.SubscriptionDAO;
import org.wso2.carbon.device.application.mgt.core.dao.common.ApplicationManagementDAOFactory;
@ -175,11 +173,11 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
return applicationInstallResponse;
} catch (DeviceManagementException e) {
String msg = "Error occurred while getting devices of given users or given roles.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (GroupManagementException e) {
String msg = "Error occurred while getting devices of given groups";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
}
}
@ -316,12 +314,12 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
return applicationDTO;
} catch (LifecycleManagementException e) {
String msg = "Error occured when getting life-cycle state from life-cycle state manager.";
log.error(msg);
throw new ApplicationManagementException(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (ApplicationManagementDAOException e) {
String msg = "Error occurred while getting application data for application release UUID: " + uuid;
log.error(msg);
throw new ApplicationManagementException(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} finally {
ConnectionManagerUtil.closeDBConnection();
}
@ -393,17 +391,16 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
ConnectionManagerUtil.rollbackDBTransaction();
String msg = "Error occurred when adding subscription data for application release ID: "
+ applicationReleaseId;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (DBConnectionException e) {
String msg = "Error occurred when getting database connection to add new device subscriptions to application.";
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (TransactionManagementException e) {
String msg =
"SQL Error occurred when adding new device subscription to application release which has ID: "
String msg = "SQL Error occurred when adding new device subscription to application release which has ID: "
+ applicationReleaseId;
log.error(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} finally {
ConnectionManagerUtil.closeDBConnection();
@ -430,16 +427,15 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
return this.subscriptionDAO.getDeviceSubscriptions(filteredDeviceIds, tenantId);
} catch (ApplicationManagementDAOException e) {
String msg = "Error occured when getting device subscriptions for given device IDs";
log.error(msg);
throw new ApplicationManagementException(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (DBConnectionException e) {
String msg = "Error occured while getting database connection for getting device subscriptions.";
log.error(msg);
throw new ApplicationManagementException(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} finally {
ConnectionManagerUtil.closeDBConnection();
}
}
private Activity addAppOperationOnDevices(ApplicationDTO applicationDTO,
@ -452,8 +448,9 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
Operation operation = generateOperationPayloadByDeviceType(deviceType, application, action);
return deviceManagementProviderService.addOperation(deviceType, operation, deviceIdentifierList);
} catch (OperationManagementException e) {
throw new ApplicationManagementException(
"Error occurred while adding the application install " + "operation to devices", e);
String msg = "Error occurred while adding the application install operation to devices";
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (InvalidDeviceException e) {
//This exception should not occur because the validation has already been done.
throw new ApplicationManagementException("The list of device identifiers are invalid");
@ -463,7 +460,6 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
private Operation generateOperationPayloadByDeviceType(String deviceType, Application application, String action)
throws ApplicationManagementException {
try {
//todo rethink and modify the {@link MobileApp} usage
MobileApp mobileApp = new MobileApp();
MobileAppTypes mobileAppType = MobileAppTypes.valueOf(application.getType());
@ -505,8 +501,8 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
}
} catch (UnknownApplicationTypeException e) {
String msg = "Unknown Application type is found.";
log.error(msg);
throw new ApplicationManagementException(msg);
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
}
}
}

@ -50,9 +50,8 @@ public class LifecycleStateManager {
try {
PermissionUtils.putPermission(lifecycleState.getPermission());
} catch (PermissionManagementException e) {
String msg =
"Error when adding permission " + lifecycleState.getPermission() + " related to the state: "
+ lifecycleState.getName();
String msg = "Error when adding permission " + lifecycleState.getPermission() + " related to the "
+ "state: " + lifecycleState.getName();
log.error(msg, e);
throw new LifecycleManagementException(msg, e);
}
@ -94,12 +93,15 @@ public class LifecycleStateManager {
}
return false;
} catch (UserStoreException e) {
throw new LifecycleManagementException(
"UserStoreException exception from changing the state from : " + currentState + " to: "
+ nextState + " with username : " + username + " and tenant Id : " + tenantId, e);
String msg = "UserStoreException exception from changing the state from : " + currentState + " to: "
+ nextState + " with username : " + username + " and tenant Id : " + tenantId;
log.error(msg, e);
throw new LifecycleManagementException(msg, e);
}
} else {
throw new LifecycleManagementException("Required permissions cannot be found for the state : " + nextState);
String msg = "Required permissions cannot be found for the state : " + nextState;
log.error(msg);
throw new LifecycleManagementException(msg);
}
}

@ -190,7 +190,6 @@ public class APIUtil {
List<DeviceType> deviceTypes;
try {
deviceTypes = DAOUtil.getDeviceManagementService().getDeviceTypes();
if (deviceTypeAttr instanceof String) {
for (DeviceType dt : deviceTypes) {
if (dt.getName().equals(deviceTypeAttr)) {
@ -209,16 +208,14 @@ public class APIUtil {
log.error(msg);
throw new BadRequestException(msg);
}
String msg =
"Invalid device type Attribute is found with the request. Device Type attribute: " + deviceTypeAttr;
String msg = "Invalid device type Attribute is found with the request. Device Type attribute: "
+ deviceTypeAttr;
log.error(msg);
throw new BadRequestException(msg);
} catch (DeviceManagementException e) {
String msg = "Error occured when getting device types which are supported by the Entgra IoTS";
log.error(msg);
throw new UnexpectedServerErrorException(msg);
log.error(msg, e);
throw new UnexpectedServerErrorException(msg, e);
}
}
@ -409,5 +406,4 @@ public class APIUtil {
return mdmConfig.getArtifactDownloadProtocol() + "://" + host + ":" + port
+ artifactDownloadEndpoint + Constants.FORWARD_SLASH;
}
}

@ -87,9 +87,10 @@ public class ApplicationManagementUtil {
return constructor.newInstance();
}
} catch (Exception e) {
throw new InvalidConfigurationException(
"Unable to get instance of extension - " + extension.getName() + " , for class - " + extension
.getClassName(), e);
String msg = "Unable to get instance of extension - " + extension.getName() + " , for class - " + extension
.getClassName();
log.error(msg, e);
throw new InvalidConfigurationException(msg, e);
}
}
}

@ -134,8 +134,8 @@ public class StorageManagementUtil {
return new FileInputStream(sourceFile);
} catch (FileNotFoundException e) {
String msg = "Couldn't file the file in file path: " + filePath;
log.error(msg);
throw new IOException(msg);
log.error(msg, e);
throw new IOException(msg, e);
}
}
@ -144,8 +144,9 @@ public class StorageManagementUtil {
try {
md5 = DigestUtils.md5Hex(binaryFile);
} catch (IOException e) {
throw new ApplicationStorageManagementException
("IO Exception while trying to get the md5sum value of application");
String msg = "IO Exception occurred while trying to get the md5sum value of application";
log.error(msg, e);
throw new ApplicationStorageManagementException(msg, e);
}
return md5;
}

Loading…
Cancel
Save