Improve error messages logging

4.x.x
lasanthaDLPDS 5 years ago
parent b3860d502e
commit 7a48f72f6b

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

@ -102,11 +102,11 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
} catch (DBConnectionException e) { } catch (DBConnectionException e) {
String msg = "Database Connection error occurred while trying to release a new version for application which" String msg = "Database Connection error occurred while trying to release a new version for application which"
+ " has app ID: " + appId; + " has app ID: " + appId;
log.error(msg); log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e); throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) { } catch (SQLException e) {
String msg = "SQL Exception while trying to release an application by executing the query " + sql; 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); throw new ApplicationManagementDAOException(msg, e);
} }
} }
@ -151,13 +151,13 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
} catch (DBConnectionException e) { } catch (DBConnectionException e) {
String msg = "Database connection error occurred while trying to get application release details which has " String msg = "Database connection error occurred while trying to get application release details which has "
+ "UUID: " + uuid; + "UUID: " + uuid;
log.error(msg); log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e); throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) { } catch (SQLException e) {
String msg = String msg =
"Error while getting application release details which has UUID: " + uuid + " , while executing" "Error while getting application release details which has UUID: " + uuid + " , while executing"
+ " the query " + sql; + " the query " + sql;
log.error(msg); log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e); throw new ApplicationManagementDAOException(msg, e);
} }
} }
@ -181,11 +181,11 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
} catch (DBConnectionException e) { } catch (DBConnectionException e) {
String msg = "Database connection error occurred while trying to update the application release rating " String msg = "Database connection error occurred while trying to update the application release rating "
+ "value for UUID: " + uuid; + "value for UUID: " + uuid;
log.error(msg); log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e); throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) { } catch (SQLException e) {
String msg = "SQL exception occured while updating the release rating value. Executed query " + sql; 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); throw new ApplicationManagementDAOException(msg, e);
} }
} }
@ -215,12 +215,12 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
} catch (DBConnectionException e) { } catch (DBConnectionException e) {
String msg = "Database connection error occured when try to get application release rating which has " String msg = "Database connection error occured when try to get application release rating which has "
+ "application release UUID: " + uuid; + "application release UUID: " + uuid;
log.error(msg); log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e); throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) { } catch (SQLException e) {
String msg = "SQL exception occured whn processing query: " + sql + " to get application release rating " String msg = "SQL exception occured whn processing query: " + sql + " to get application release rating "
+ "which has application release uuid: " + uuid; + "which has application release uuid: " + uuid;
log.error(msg); log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e); throw new ApplicationManagementDAOException(msg, e);
} }
} }
@ -248,12 +248,12 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
} catch (DBConnectionException e) { } catch (DBConnectionException e) {
String msg = "Database connection exception occurred when getting all release rating values for a " String msg = "Database connection exception occurred when getting all release rating values for a "
+ "particular application."; + "particular application.";
log.error(msg); log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e); throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) { } catch (SQLException e) {
String msg = "SQL exception occurred while getting all release rating values for a particular application. " String msg = "SQL exception occurred while getting all release rating values for a particular application. "
+ "Executed query is" + sql; + "Executed query is" + sql;
log.error(msg); log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e); throw new ApplicationManagementDAOException(msg, e);
} }
} }
@ -310,12 +310,12 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
} catch (DBConnectionException e) { } catch (DBConnectionException e) {
String msg = "Database connection exception occured while trying to update the application release which " String msg = "Database connection exception occured while trying to update the application release which "
+ "has application release ID: " + applicationReleaseDTO.getId(); + "has application release ID: " + applicationReleaseDTO.getId();
log.error(msg); log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e); throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) { } catch (SQLException e) {
String msg = "SQL exception occured while updating the application release which has release ID: " String msg = "SQL exception occured while updating the application release which has release ID: "
+ applicationReleaseDTO.getId() + ". Executed query is " + sql; + applicationReleaseDTO.getId() + ". Executed query is " + sql;
log.error(msg); log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e); throw new ApplicationManagementDAOException(msg, e);
} }
return applicationReleaseDTO; return applicationReleaseDTO;
@ -335,12 +335,12 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
} catch (DBConnectionException e) { } catch (DBConnectionException e) {
String msg = "Database connection exception occurred while trying to delete the application release which " String msg = "Database connection exception occurred while trying to delete the application release which "
+ "has ID: " + id; + "has ID: " + id;
log.error(msg); log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e); throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) { } catch (SQLException e) {
String msg = "SQL exception occurred while deleting the release for release ID: " + id + ",while executing" String msg = "SQL exception occurred while deleting the release for release ID: " + id + ",while executing"
+ " the query sql " + sql; + " the query sql " + sql;
log.error(msg); log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e); throw new ApplicationManagementDAOException(msg, e);
} }
} }
@ -362,12 +362,12 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
} catch (DBConnectionException e) { } catch (DBConnectionException e) {
String msg = "Database connection exception occurred while trying to delete application releases for given " String msg = "Database connection exception occurred while trying to delete application releases for given "
+ "application release ids"; + "application release ids";
log.error(msg); log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e); throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) { } catch (SQLException e) {
String msg = "SQL exception occurred while execute delete query for deleting given application releases. " String msg = "SQL exception occurred while execute delete query for deleting given application releases. "
+ "Executed query: " + sql; + "Executed query: " + sql;
log.error(msg); log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e); throw new ApplicationManagementDAOException(msg, e);
} }
} }
@ -395,12 +395,12 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
} catch (DBConnectionException e) { } catch (DBConnectionException e) {
String msg = "Database connection error occurred while verifying release existence for app release hash " String msg = "Database connection error occurred while verifying release existence for app release hash "
+ "value. Hash value: " + hashVal; + "value. Hash value: " + hashVal;
log.error(msg); log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e); throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) { } catch (SQLException e) {
String msg = "Error occurred while getting application release details for application release hash value: " String msg = "Error occurred while getting application release details for application release hash value: "
+ hashVal + " While executing query "; + hashVal + " While executing query ";
log.error(msg); log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e); throw new ApplicationManagementDAOException(msg, e);
} }
} }
@ -434,12 +434,12 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
} catch (DBConnectionException e) { } catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection to get application release package name " String msg = "Error occurred while obtaining the DB connection to get application release package name "
+ "which has application release UUID: " + releaseUuid; + "which has application release UUID: " + releaseUuid;
log.error(msg); log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e); throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) { } catch (SQLException e) {
String msg = "Error occurred while getting package name of the application release with app UUID: " String msg = "Error occurred while getting package name of the application release with app UUID: "
+ releaseUuid; + releaseUuid;
log.error(msg); log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e); throw new ApplicationManagementDAOException(msg, e);
} }
} }
@ -472,12 +472,12 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
} catch (DBConnectionException e) { } catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection to get hash value for application release " String msg = "Error occurred while obtaining the DB connection to get hash value for application release "
+ "which has application release UUID: " + uuid; + "which has application release UUID: " + uuid;
log.error(msg); log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e); throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) { } catch (SQLException e) {
String msg = "Error occurred when executing query to get application release hash value which has " String msg = "Error occurred when executing query to get application release hash value which has "
+ "application release uuid: " + uuid + ". Executed query: " + sql; + "application release uuid: " + uuid + ". Executed query: " + sql;
log.error(msg); log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e); throw new ApplicationManagementDAOException(msg, e);
} }
} }
@ -506,12 +506,12 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
} catch (DBConnectionException e) { } catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection to verify the existence of package name for " String msg = "Error occurred while obtaining the DB connection to verify the existence of package name for "
+ "active application release. Package name: " + packageName; + "active application release. Package name: " + packageName;
log.error(msg); log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e); throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) { } catch (SQLException e) {
String msg = "SQL error occurred while verifying the existence of package name for active application " String msg = "SQL error occurred while verifying the existence of package name for active application "
+ "release. package name: " + packageName; + "release. package name: " + packageName;
log.error(msg); log.error(msg, e);
throw new ApplicationManagementDAOException(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 " 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 " + "application release uuid ;" + releaseUuid + " and application release state "
+ installableStateName; + installableStateName;
log.error(msg); log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e); throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) { } catch (SQLException e) {
String msg = "Error occurred while executing SQL to verify the existence of app release for application " String msg = "Error occurred while executing SQL to verify the existence of app release for application "
+ "release uuid ;" + releaseUuid + " and application release state " + installableStateName; + "release uuid ;" + releaseUuid + " and application release state " + installableStateName;
log.error(msg); log.error(msg, e);
throw new ApplicationManagementDAOException(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); private static final Log log = LogFactory.getLog(GenericLifecycleStateDAOImpl.class);
@Override @Override
public LifecycleState getLatestLifeCycleState(String uuid) throws LifeCycleManagementDAOException{ public LifecycleState getLatestLifecycleState(String uuid) throws LifeCycleManagementDAOException{
String sql = "SELECT " String sql = "SELECT "
+ "CURRENT_STATE, " + "CURRENT_STATE, "
+ "PREVIOUS_STATE, " + "PREVIOUS_STATE, "
@ -66,12 +66,12 @@ public class GenericLifecycleStateDAOImpl extends AbstractDAOImpl implements Lif
} catch (DBConnectionException e) { } catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection to get latest lifecycle state for a specific" String msg = "Error occurred while obtaining the DB connection to get latest lifecycle state for a specific"
+ " application. Application release UUID: " + uuid; + " application. Application release UUID: " + uuid;
log.error(msg); log.error(msg, e);
throw new LifeCycleManagementDAOException(msg, e); throw new LifeCycleManagementDAOException(msg, e);
} catch (SQLException e) { } catch (SQLException e) {
String msg = "Error occurred while executing query to get latest lifecycle state for a specific " String msg = "Error occurred while executing query to get latest lifecycle state for a specific "
+ "application. Application release UUID: " + uuid + ". Executed Query: " + sql; + "application. Application release UUID: " + uuid + ". Executed Query: " + sql;
log.error(msg); log.error(msg, e);
throw new LifeCycleManagementDAOException(msg, e); throw new LifeCycleManagementDAOException(msg, e);
} }
} }
@ -99,14 +99,18 @@ public class GenericLifecycleStateDAOImpl extends AbstractDAOImpl implements Lif
rs = stmt.executeQuery(); rs = stmt.executeQuery();
if (rs.next()) { if (rs.next()) {
return rs.getString("UPDATED_BY"); return rs.getString("UPDATED_BY");
} }
return null; return null;
} catch (SQLException e) { } catch (DBConnectionException e) {
throw new LifeCycleManagementDAOException("Error occurred while getting application List", e); String msg = "Error occurred while obtaining the DB connection to get the created user of a release which "
} catch (DBConnectionException e) { + "has APP ID " + appId + " and release UUID ." + uuid;
throw new LifeCycleManagementDAOException("Error occurred while obtaining the DB connection to get latest" log.error(msg, e);
+ " lifecycle state for a specific application", 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 { } finally {
DAOUtil.cleanupResources(stmt, rs); DAOUtil.cleanupResources(stmt, rs);
} }
@ -138,12 +142,12 @@ public class GenericLifecycleStateDAOImpl extends AbstractDAOImpl implements Lif
} catch (DBConnectionException e) { } catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection when getting lifecycle states for an " String msg = "Error occurred while obtaining the DB connection when getting lifecycle states for an "
+ "application which has application ID: " + appReleaseId; + "application which has application ID: " + appReleaseId;
log.error(msg); log.error(msg, e);
throw new LifeCycleManagementDAOException(msg, e); throw new LifeCycleManagementDAOException(msg, e);
} catch (SQLException e) { } catch (SQLException e) {
String msg = "SQL Error occurred while retrieving lifecycle states for application which has application " String msg = "SQL Error occurred while retrieving lifecycle states for application which has application "
+ "ID: " + appReleaseId; + "ID: " + appReleaseId;
log.error(msg); log.error(msg, e);
throw new LifeCycleManagementDAOException(msg, e); throw new LifeCycleManagementDAOException(msg, e);
} }
return lifecycleStates; return lifecycleStates;
@ -177,13 +181,13 @@ public class GenericLifecycleStateDAOImpl extends AbstractDAOImpl implements Lif
} catch (DBConnectionException e) { } catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection to add lifecycle state for application " String msg = "Error occurred while obtaining the DB connection to add lifecycle state for application "
+ "release which has ID " + appReleaseId + ". Lifecycle state " + state.getCurrentState(); + "release which has ID " + appReleaseId + ". Lifecycle state " + state.getCurrentState();
log.error(msg); log.error(msg, e);
throw new LifeCycleManagementDAOException(msg, e); throw new LifeCycleManagementDAOException(msg, e);
} catch (SQLException e) { } catch (SQLException e) {
String msg = "Error occurred while executing the query to add lifecycle state for application release which" 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: " + " has ID " + appReleaseId + ". Lifecycle state " + state.getCurrentState() + ". Executed query: "
+ sql; + sql;
log.error(msg); log.error(msg, e);
throw new LifeCycleManagementDAOException(msg, e); throw new LifeCycleManagementDAOException(msg, e);
} }
} }
@ -202,12 +206,12 @@ public class GenericLifecycleStateDAOImpl extends AbstractDAOImpl implements Lif
} catch (DBConnectionException e) { } catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection to delete lifecycle states for application " String msg = "Error occurred while obtaining the DB connection to delete lifecycle states for application "
+ "release ID: " + releaseId; + "release ID: " + releaseId;
log.error(msg); log.error(msg, e);
throw new LifeCycleManagementDAOException(msg, e); throw new LifeCycleManagementDAOException(msg, e);
} catch (SQLException e) { } catch (SQLException e) {
String msg = "Error occurred while executing the query to delete lifecycle states for application release" String msg = "Error occurred while executing the query to delete lifecycle states for application release"
+ " ID: " + releaseId + ". Executed query " + sql; + " ID: " + releaseId + ". Executed query " + sql;
log.error(msg); log.error(msg, e);
throw new LifeCycleManagementDAOException(msg, e); throw new LifeCycleManagementDAOException(msg, e);
} }
} }
@ -229,20 +233,30 @@ public class GenericLifecycleStateDAOImpl extends AbstractDAOImpl implements Lif
} catch (DBConnectionException e) { } catch (DBConnectionException e) {
String msg = "Error occurred while obtaining the DB connection for deleting application life-cycle states " String msg = "Error occurred while obtaining the DB connection for deleting application life-cycle states "
+ "for given application Ids."; + "for given application Ids.";
log.error(msg); log.error(msg, e);
throw new LifeCycleManagementDAOException(msg, e); throw new LifeCycleManagementDAOException(msg, e);
} catch (SQLException e) { } catch (SQLException e) {
String msg = "Error occurred while executing query to delete application life-cycle states for given " String msg = "Error occurred while executing query to delete application life-cycle states for given "
+ "application Ids."; + "application Ids.";
log.error(msg); log.error(msg, e);
throw new LifeCycleManagementDAOException(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 { private LifecycleState constructLifecycle(ResultSet rs) throws LifeCycleManagementDAOException {
LifecycleState lifecycleState = null;
try { try {
if (rs !=null && rs.next()) { if (rs !=null && rs.next()) {
LifecycleState lifecycleState = new LifecycleState(); lifecycleState = new LifecycleState();
lifecycleState.setCurrentState(rs.getString("CURRENT_STATE")); lifecycleState.setCurrentState(rs.getString("CURRENT_STATE"));
lifecycleState.setPreviousState(rs.getString("PREVIOUS_STATE")); lifecycleState.setPreviousState(rs.getString("PREVIOUS_STATE"));
lifecycleState.setUpdatedAt(rs.getTimestamp("UPDATED_AT")); lifecycleState.setUpdatedAt(rs.getTimestamp("UPDATED_AT"));
@ -250,9 +264,9 @@ public class GenericLifecycleStateDAOImpl extends AbstractDAOImpl implements Lif
} }
} catch (SQLException e) { } catch (SQLException e) {
String msg = "Error occurred while construct lifecycle state by data which is retrieved from SQL query"; 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); throw new LifeCycleManagementDAOException(msg, e);
} }
return null; return lifecycleState;
} }
} }

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

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

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

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

@ -109,7 +109,7 @@ public class ApplicationStorageManagerImpl implements ApplicationStorageManager
} catch (IOException e) { } catch (IOException e) {
String msg = "IO Exception occurred while saving application artifacts for the application which has UUID " String msg = "IO Exception occurred while saving application artifacts for the application which has UUID "
+ applicationReleaseDTO.getUuid(); + applicationReleaseDTO.getUuid();
log.error(msg); log.error(msg, e);
throw new ApplicationStorageManagementException(msg, e); throw new ApplicationStorageManagementException(msg, e);
} }
} }
@ -136,8 +136,8 @@ public class ApplicationStorageManagerImpl implements ApplicationStorageManager
} }
} catch (ParsingException e){ } catch (ParsingException e){
String msg = "Application Type doesn't match with supporting application types " + deviceType; String msg = "Application Type doesn't match with supporting application types " + deviceType;
log.error(msg); log.error(msg, e);
throw new ApplicationStorageManagementException(msg); throw new ApplicationStorageManagementException(msg, e);
} }
return applicationInstaller; return applicationInstaller;
} }
@ -158,7 +158,7 @@ public class ApplicationStorageManagerImpl implements ApplicationStorageManager
} catch (IOException e) { } catch (IOException e) {
String msg = "IO Exception while saving the release artifacts in the server for the application UUID " String msg = "IO Exception while saving the release artifacts in the server for the application UUID "
+ applicationReleaseDTO.getUuid(); + applicationReleaseDTO.getUuid();
log.error(msg); log.error(msg, e);
throw new ApplicationStorageManagementException( msg, e); throw new ApplicationStorageManagementException( msg, e);
} }
return applicationReleaseDTO; return applicationReleaseDTO;
@ -213,7 +213,7 @@ public class ApplicationStorageManagerImpl implements ApplicationStorageManager
deleteAppReleaseArtifact( storagePath + deletingAppHashValue); deleteAppReleaseArtifact( storagePath + deletingAppHashValue);
} catch (IOException e) { } catch (IOException e) {
String msg = "Application installer updating is failed because of I/O issue"; String msg = "Application installer updating is failed because of I/O issue";
log.error(msg); log.error(msg, e);
throw new ApplicationStorageManagementException(msg, e); throw new ApplicationStorageManagementException(msg, e);
} }
} }
@ -243,6 +243,7 @@ public class ApplicationStorageManagerImpl implements ApplicationStorageManager
return StorageManagementUtil.getInputStream(filePath); return StorageManagementUtil.getInputStream(filePath);
} catch (IOException e) { } catch (IOException e) {
String msg = "Error occured when accessing the file in file path: " + filePath; String msg = "Error occured when accessing the file in file path: " + filePath;
log.error(msg, e);
throw new ApplicationStorageManagementException(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.internal.DataHolder;
import org.wso2.carbon.device.application.mgt.core.lifecycle.LifecycleStateManager; 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.ConnectionManagerUtil;
import org.wso2.carbon.device.application.mgt.core.util.Constants;
import java.io.InputStream; import java.io.InputStream;
import java.util.Map; import java.util.Map;
@ -46,12 +45,9 @@ public class AppmDataHandlerImpl implements AppmDataHandler {
private UIConfiguration uiConfiguration; private UIConfiguration uiConfiguration;
private LifecycleStateManager lifecycleStateManager; private LifecycleStateManager lifecycleStateManager;
public AppmDataHandlerImpl(UIConfiguration config) { public AppmDataHandlerImpl(UIConfiguration config) {
this.uiConfiguration = config; this.uiConfiguration = config;
lifecycleStateManager = DataHolder.getInstance().getLifecycleStateManager(); lifecycleStateManager = DataHolder.getInstance().getLifecycleStateManager();
} }
@Override @Override
@ -90,15 +86,14 @@ public class AppmDataHandlerImpl implements AppmDataHandler {
String msg = String msg =
"Error occurred when retrieving application release hash value for given application release UUID: " "Error occurred when retrieving application release hash value for given application release UUID: "
+ uuid; + uuid;
log.error(msg); log.error(msg, e);
throw new ApplicationManagementException(msg); throw new ApplicationManagementException(msg, e);
} catch (ApplicationStorageManagementException e) { } catch (ApplicationStorageManagementException e) {
String msg = "Error occurred when getting input stream of the " + artifactName + " file."; String msg = "Error occurred when getting input stream of the " + artifactName + " file.";
log.error(msg); log.error(msg, e);
throw new ApplicationManagementException(msg); throw new ApplicationManagementException(msg, e);
} finally { } finally {
ConnectionManagerUtil.closeDBConnection(); ConnectionManagerUtil.closeDBConnection();
} }
} }
} }

@ -141,22 +141,22 @@ public class ReviewManagerImpl implements ReviewManager {
} catch (DBConnectionException e) { } catch (DBConnectionException e) {
String msg = "DB Connection error occurs when adding Review for application release with UUID: " + uuid String msg = "DB Connection error occurs when adding Review for application release with UUID: " + uuid
+ " is failed"; + " is failed";
log.error(msg); log.error(msg, e);
throw new ReviewManagementException(msg, e); throw new ReviewManagementException(msg, e);
} catch (TransactionManagementException e) { } catch (TransactionManagementException e) {
String msg = "DB transaction error occurred when adding review for application release which has " String msg = "DB transaction error occurred when adding review for application release which has "
+ "application UUID: " + uuid; + "application UUID: " + uuid;
log.error(msg); log.error(msg, e);
throw new ReviewManagementException(msg, e); throw new ReviewManagementException(msg, e);
} catch (ApplicationManagementDAOException e) { } catch (ApplicationManagementDAOException e) {
String msg = "Error occurred when getting application release data for application release UUID:." + uuid; 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); throw new ReviewManagementException(msg, e);
} catch (ReviewManagementDAOException e) { } catch (ReviewManagementDAOException e) {
ConnectionManagerUtil.rollbackDBTransaction(); ConnectionManagerUtil.rollbackDBTransaction();
String msg = "Error occurred when getting review data or adding review data for application release which " String msg = "Error occurred when getting review data or adding review data for application release which "
+ "has UUID: " + uuid; + "has UUID: " + uuid;
log.error(msg); log.error(msg, e);
throw new ReviewManagementException(msg, e); throw new ReviewManagementException(msg, e);
} finally { } finally {
ConnectionManagerUtil.closeDBConnection(); ConnectionManagerUtil.closeDBConnection();
@ -212,39 +212,42 @@ public class ReviewManagerImpl implements ReviewManager {
ConnectionManagerUtil.rollbackDBTransaction(); ConnectionManagerUtil.rollbackDBTransaction();
return false; return false;
} catch (DBConnectionException e) { } catch (DBConnectionException e) {
throw new ReviewManagementException( String msg = "DB Connection error occurred while adding reply comment for app review of application release"
"DB Connection error occurs ,Review for application release with UUID: " + uuid + " is failed", e); + " which has UUID: " + uuid + " and review Id " + parentReviewId;
log.error(msg, e);
throw new ReviewManagementException(msg, e);
} catch (TransactionManagementException e) { } catch (TransactionManagementException e) {
String msg = "DB transaction error occurred when adding reply comment for comment which has comment id: " String msg = "DB transaction error occurred when adding reply comment for comment which has comment id: "
+ parentReviewId; + parentReviewId;
log.error(msg); log.error(msg, e);
throw new ReviewManagementException(msg, e); throw new ReviewManagementException(msg, e);
} catch (ApplicationManagementDAOException e) { } catch (ApplicationManagementDAOException e) {
ConnectionManagerUtil.rollbackDBTransaction(); ConnectionManagerUtil.rollbackDBTransaction();
throw new ReviewManagementException( String msg = "Error occured while verifying whether application release is exists or not for UUID " + uuid;
"Error occured while verifying whether application release is exists or not.", e); log.error(msg, e);
throw new ReviewManagementException(msg, e);
} finally { } finally {
ConnectionManagerUtil.closeDBConnection(); ConnectionManagerUtil.closeDBConnection();
} }
} }
private ReviewDTO reviewWrapperToDTO(ReviewWrapper reviewWrapper){ private ReviewDTO reviewWrapperToDTO(ReviewWrapper reviewWrapper) {
ReviewDTO reviewDTO = new ReviewDTO(); ReviewDTO reviewDTO = new ReviewDTO();
reviewDTO.setContent(reviewWrapper.getContent()); reviewDTO.setContent(reviewWrapper.getContent());
reviewDTO.setRating(reviewWrapper.getRating()); reviewDTO.setRating(reviewWrapper.getRating());
return reviewDTO; return reviewDTO;
} }
private List<Review> reviewDTOToReview(List<ReviewDTO> reviewDTOs){ private List<Review> reviewDTOToReview(List<ReviewDTO> reviewDTOs) {
List<Review> reviews = new ArrayList<>(); List<Review> reviews = new ArrayList<>();
for (ReviewDTO reviewDTO : reviewDTOs){ for (ReviewDTO reviewDTO : reviewDTOs) {
reviews.add(reviewDTOToReview(reviewDTO)); reviews.add(reviewDTOToReview(reviewDTO));
} }
return reviews; return reviews;
} }
private Review reviewDTOToReview(ReviewDTO reviewDTO){ private Review reviewDTOToReview(ReviewDTO reviewDTO) {
Review review = new Review(); Review review = new Review();
review.setId(reviewDTO.getId()); review.setId(reviewDTO.getId());
review.setContent(reviewDTO.getContent()); review.setContent(reviewDTO.getContent());
@ -264,7 +267,7 @@ public class ReviewManagerImpl implements ReviewManager {
return this.reviewDAO.getReview(reviewId, tenantId); return this.reviewDAO.getReview(reviewId, tenantId);
} catch (DBConnectionException e) { } catch (DBConnectionException e) {
String msg = "DB Connection error occurs updating reviewTmp with reviewTmp id " + reviewId + "."; String msg = "DB Connection error occurs updating reviewTmp with reviewTmp id " + reviewId + ".";
log.error(msg); log.error(msg, e);
throw new ReviewManagementException(msg, e); throw new ReviewManagementException(msg, e);
} finally { } finally {
ConnectionManagerUtil.closeDBConnection(); ConnectionManagerUtil.closeDBConnection();
@ -343,8 +346,8 @@ public class ReviewManagerImpl implements ReviewManager {
} }
} }
private ReviewDTO updateReviewInDB(ReviewDTO reviewDTO, int reviewId, boolean isActiveReview, private ReviewDTO updateReviewInDB(ReviewDTO reviewDTO, int reviewId, boolean isActiveReview, int tenantId)
int tenantId) throws ReviewManagementException, ApplicationManagementException { throws ReviewManagementException, ApplicationManagementException {
try { try {
ConnectionManagerUtil.beginDBTransaction(); ConnectionManagerUtil.beginDBTransaction();
ReviewDTO updatedReviewDTO = this.reviewDAO.updateReview(reviewDTO, reviewId, isActiveReview, tenantId); ReviewDTO updatedReviewDTO = this.reviewDAO.updateReview(reviewDTO, reviewId, isActiveReview, tenantId);
@ -357,15 +360,15 @@ public class ReviewManagerImpl implements ReviewManager {
} catch (ReviewManagementDAOException e) { } catch (ReviewManagementDAOException e) {
ConnectionManagerUtil.rollbackDBTransaction(); ConnectionManagerUtil.rollbackDBTransaction();
String msg = "Error occured while getting reviewTmp with reviewTmp id " + reviewId + "."; String msg = "Error occured while getting reviewTmp with reviewTmp id " + reviewId + ".";
log.error(msg); log.error(msg, e);
throw new ReviewManagementException(msg, e); throw new ReviewManagementException(msg, e);
} catch (DBConnectionException e) { } catch (DBConnectionException e) {
String msg = "DB Connection error occurs updating reviewTmp with reviewTmp id " + reviewId + "."; String msg = "DB Connection error occurs updating reviewTmp with reviewTmp id " + reviewId + ".";
log.error(msg); log.error(msg, e);
throw new ReviewManagementException(msg, e); throw new ReviewManagementException(msg, e);
} catch (TransactionManagementException e) { } catch (TransactionManagementException e) {
String msg = "DB transaction error occurred when updating comment which has comment id: " + reviewId; 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); throw new ReviewManagementException(msg, e);
} finally { } finally {
ConnectionManagerUtil.closeDBConnection(); ConnectionManagerUtil.closeDBConnection();
@ -382,20 +385,25 @@ public class ReviewManagerImpl implements ReviewManager {
try { try {
ConnectionManagerUtil.openDBConnection(); ConnectionManagerUtil.openDBConnection();
ApplicationReleaseDTO releaseDTO = this.applicationReleaseDAO.getReleaseByUUID(uuid, tenantId); ApplicationReleaseDTO releaseDTO = this.applicationReleaseDAO.getReleaseByUUID(uuid, tenantId);
if (releaseDTO == null){ if (releaseDTO == null) {
String msg = "Couldn't found an application release for UUID: " + uuid; String msg = "Couldn't found an application release for UUID: " + uuid;
log.error(msg); log.error(msg);
throw new NotFoundException(msg); throw new NotFoundException(msg);
} }
return getReviewTree(this.reviewDAO.getAllReleaseReviews(releaseDTO.getId(), request, tenantId)); return getReviewTree(this.reviewDAO.getAllReleaseReviews(releaseDTO.getId(), request, tenantId));
} catch (ReviewManagementDAOException e) { } catch (ReviewManagementDAOException e) {
throw new ReviewManagementException("Error occured while getting all reviews for application uuid: " + uuid, String msg = "Error occured while getting all reviews for application uuid: " + uuid;
e); log.error(msg, e);
throw new ReviewManagementException(msg, e);
} catch (DBConnectionException 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) { } catch (ApplicationManagementDAOException e) {
String msg = "Error occurred while getting application release details for application release UUId " + uuid; String msg =
log.error(msg); "Error occurred while getting application release details for application release UUId " + uuid;
log.error(msg, e);
throw new ApplicationManagementException(msg, e); throw new ApplicationManagementException(msg, e);
} finally { } finally {
ConnectionManagerUtil.closeDBConnection(); ConnectionManagerUtil.closeDBConnection();
@ -416,11 +424,11 @@ public class ReviewManagerImpl implements ReviewManager {
} catch (ReviewManagementDAOException e) { } catch (ReviewManagementDAOException e) {
String msg = "Error occured while getting all reviews for application which has an " String msg = "Error occured while getting all reviews for application which has an "
+ "application release of uuid: " + uuid; + "application release of uuid: " + uuid;
log.error(msg); log.error(msg, e);
throw new ReviewManagementException(msg, e); throw new ReviewManagementException(msg, e);
} catch (DBConnectionException e) { } catch (DBConnectionException e) {
String msg = "Error occured while getting the DB connection to get app app reviews."; 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); throw new ReviewManagementException(msg, e);
} finally { } finally {
ConnectionManagerUtil.closeDBConnection(); ConnectionManagerUtil.closeDBConnection();
@ -441,18 +449,23 @@ public class ReviewManagerImpl implements ReviewManager {
List<ReviewDTO> reviewDtos = this.reviewDAO List<ReviewDTO> reviewDtos = this.reviewDAO
.getAllActiveAppReviewsOfUser(applicationReleaseIds, request, username, tenantId); .getAllActiveAppReviewsOfUser(applicationReleaseIds, request, username, tenantId);
if (!reviewDtos.isEmpty() && reviewDtos.size() > 1) { if (!reviewDtos.isEmpty() && reviewDtos.size() > 1) {
String msg = "User " + username + " can't have more than active application review for application which" String msg =
+ " has application release of UUID: " + uuid; "User " + username + " can't have more than active application review for application which"
+ " has application release of UUID: " + uuid;
log.error(msg); log.error(msg);
throw new ApplicationManagementException(msg); throw new ApplicationManagementException(msg);
} }
return getReviewTree(reviewDtos); return getReviewTree(reviewDtos);
} catch (ReviewManagementDAOException e) { } catch (ReviewManagementDAOException e) {
throw new ReviewManagementException("Error occured while getting all reviews for application which has an " String msg = "Error occured while getting all " + username + "'s reviews for application which has an "
+ "application release of uuid: " + uuid, + "application release of uuid: " + uuid;
e); log.error(msg, e);
throw new ReviewManagementException(msg, e);
} catch (DBConnectionException 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 { } finally {
ConnectionManagerUtil.closeDBConnection(); ConnectionManagerUtil.closeDBConnection();
} }
@ -471,14 +484,15 @@ public class ReviewManagerImpl implements ReviewManager {
return applicationDTO.getApplicationReleaseDTOs().stream().map(ApplicationReleaseDTO::getId) return applicationDTO.getApplicationReleaseDTOs().stream().map(ApplicationReleaseDTO::getId)
.collect(Collectors.toList()); .collect(Collectors.toList());
} catch (DBConnectionException e) { } catch (DBConnectionException e) {
String msg = "Error occured while getting the DB connection to get application which has application release" String msg =
+ " of UUID: " + uuid; "Error occured while getting the DB connection to get application which has application release"
log.error(msg); + " of UUID: " + uuid;
log.error(msg, e);
throw new ReviewManagementException(msg, e); throw new ReviewManagementException(msg, e);
} catch (ApplicationManagementDAOException e) { } catch (ApplicationManagementDAOException e) {
String msg = "Error occurred while getting application release details for application which has an " String msg = "Error occurred while getting application release details for application which has an "
+ "application release of UUID " + uuid; + "application release of UUID " + uuid;
log.error(msg); log.error(msg, e);
throw new ApplicationManagementException(msg, e); throw new ApplicationManagementException(msg, e);
} finally { } finally {
ConnectionManagerUtil.closeDBConnection(); ConnectionManagerUtil.closeDBConnection();
@ -511,13 +525,14 @@ public class ReviewManagerImpl implements ReviewManager {
paginationResult.setRecordsTotal(numOfReviews); paginationResult.setRecordsTotal(numOfReviews);
return paginationResult; return paginationResult;
} catch (ReviewManagementDAOException e) { } catch (ReviewManagementDAOException e) {
throw new ReviewManagementException("Error occured while getting all reply comments for given review list", String msg = "Error occured while getting all reply comments for given review list";
e); log.error(msg, e);
throw new ReviewManagementException(msg, e);
} }
} }
private ReviewNode<ReviewDTO> findAndSetChild(ReviewNode<ReviewDTO> node, ReviewDTO reviewDTO) { 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); ReviewNode<ReviewDTO> childNode = new ReviewNode<>(reviewDTO);
node.addChild(childNode); node.addChild(childNode);
return node; return node;
@ -530,10 +545,10 @@ public class ReviewManagerImpl implements ReviewManager {
private Review constructReviewResponse(Review parentReview, ReviewNode<ReviewDTO> node) { private Review constructReviewResponse(Review parentReview, ReviewNode<ReviewDTO> node) {
Review review = reviewDTOToReview(node.getData()); Review review = reviewDTOToReview(node.getData());
if (parentReview != null){ if (parentReview != null) {
parentReview.getReplies().add(review); parentReview.getReplies().add(review);
} }
if (node.getChildren().isEmpty()){ if (node.getChildren().isEmpty()) {
return review; return review;
} }
for (ReviewNode<ReviewDTO> reviewDTOReviewNode : node.getChildren()) { 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) { private List<Integer> getDeletingReviewIds(ReviewNode<ReviewDTO> node, List<Integer> reviewIds) {
reviewIds.add(node.getData().getId()); reviewIds.add(node.getData().getId());
if (node.getChildren().isEmpty()){ if (node.getChildren().isEmpty()) {
return reviewIds; return reviewIds;
} }
for (ReviewNode<ReviewDTO> each : node.getChildren()) { for (ReviewNode<ReviewDTO> each : node.getChildren()) {
@ -567,8 +582,7 @@ public class ReviewManagerImpl implements ReviewManager {
return reviewIds; return reviewIds;
} }
@Override @Override public void deleteReview(String uuid, int reviewId, boolean isPriviledgedUser)
public void deleteReview(String uuid, int reviewId, boolean isPriviledgedUser)
throws ReviewManagementException, ApplicationManagementException { throws ReviewManagementException, ApplicationManagementException {
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true); int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true);
String username = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername(); String username = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername();
@ -580,7 +594,7 @@ public class ReviewManagerImpl implements ReviewManager {
log.error(msg); log.error(msg);
throw new NotFoundException(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 " String msg = "You are trying to delete a review which is not associated with application release which "
+ "has UUID: " + uuid; + "has UUID: " + uuid;
log.error(msg); log.error(msg);
@ -606,7 +620,7 @@ public class ReviewManagerImpl implements ReviewManager {
ReviewNode<ReviewDTO> reviewNode = new ReviewNode<>(rootReview); ReviewNode<ReviewDTO> reviewNode = new ReviewNode<>(rootReview);
replyComments.sort(Comparator.comparing(ReviewDTO::getId)); replyComments.sort(Comparator.comparing(ReviewDTO::getId));
for (ReviewDTO reply : replyComments) { for (ReviewDTO reply : replyComments) {
reviewNode = findAndSetChild(reviewNode, reply); reviewNode = findAndSetChild(reviewNode, reply);
} }
ReviewNode<ReviewDTO> deletingRevieNode = getReviewNode(reviewNode, existingReview.getId()); ReviewNode<ReviewDTO> deletingRevieNode = getReviewNode(reviewNode, existingReview.getId());
@ -616,56 +630,58 @@ public class ReviewManagerImpl implements ReviewManager {
} }
} catch (DBConnectionException e) { } catch (DBConnectionException e) {
String msg = "DB Connection error occurs deleting review with review id " + reviewId + "."; String msg = "DB Connection error occurs deleting review with review id " + reviewId + ".";
log.error(msg); log.error(msg, e);
throw new ReviewManagementException(msg, e); throw new ReviewManagementException(msg, e);
} catch (ReviewManagementDAOException e) { } catch (ReviewManagementDAOException e) {
ConnectionManagerUtil.rollbackDBTransaction(); ConnectionManagerUtil.rollbackDBTransaction();
String msg = "Error occured while deleting review with review id " + reviewId + "."; String msg = "Error occured while deleting review with review id " + reviewId + ".";
log.error(msg); log.error(msg, e);
throw new ReviewManagementException(msg, e); throw new ReviewManagementException(msg, e);
} catch (TransactionManagementException e) { } catch (TransactionManagementException e) {
String msg = "Error occurred when handleing transaction to delete application reviews."; String msg = "Error occurred when handleing transaction to delete application reviews.";
log.error(msg); log.error(msg, e);
throw new ReviewManagementException(msg, e); throw new ReviewManagementException(msg, e);
} finally { } finally {
ConnectionManagerUtil.closeDBConnection(); ConnectionManagerUtil.closeDBConnection();
} }
} }
@Override @Override public Rating getAppReleaseRating(String appReleaseUuid)
public Rating getAppReleaseRating(String appReleaseUuid) throws ReviewManagementException, ApplicationManagementException { throws ReviewManagementException, ApplicationManagementException {
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true); int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true);
try { try {
ConnectionManagerUtil.openDBConnection(); ConnectionManagerUtil.openDBConnection();
Rating rating = this.applicationReleaseDAO.getReleaseRating(appReleaseUuid, tenantId); Rating rating = this.applicationReleaseDAO.getReleaseRating(appReleaseUuid, tenantId);
if (rating == null) { if (rating == null) {
throw new NotFoundException( throw new NotFoundException("Couldn't find rating for application release UUID: " + appReleaseUuid
"Couldn't find rating for application release UUID: " + appReleaseUuid + ". Please check the existence of the application release");
+ ". Please check the existence of the application release");
} }
List<Integer> ratingValues = this.reviewDAO.getAllAppReleaseRatingValues(appReleaseUuid, tenantId); List<Integer> ratingValues = this.reviewDAO.getAllAppReleaseRatingValues(appReleaseUuid, tenantId);
rating.setRatingVariety(constructRatingVariety(ratingValues)); rating.setRatingVariety(constructRatingVariety(ratingValues));
return rating; return rating;
} catch (ApplicationManagementDAOException e) { } catch (ApplicationManagementDAOException e) {
throw new ReviewManagementException( String msg =
"Error occured while getting the rating value of the application release uuid: " + appReleaseUuid, "Error occured while getting the rating value of the application release uuid: " + appReleaseUuid;
e); log.error(msg, e);
throw new ReviewManagementException(msg, e);
} catch (DBConnectionException e) { } catch (DBConnectionException e) {
throw new ReviewManagementException( String msg = "DB Connection error occured while getting the rating value of the application release uuid: "
"DB Connection error occured while getting the rating value of the application release uuid: " + appReleaseUuid;
+ appReleaseUuid, e); log.error(msg, e);
throw new ReviewManagementException(msg, e);
} catch (ReviewManagementDAOException e) { } catch (ReviewManagementDAOException e) {
throw new ReviewManagementException( String msg = "Error occured while getting all rating values for the application release UUID: "
"Error occured while getting all rating values for the application release UUID: " + appReleaseUuid;
+ appReleaseUuid, e); log.error(msg, e);
throw new ReviewManagementException(msg, e);
} finally { } finally {
ConnectionManagerUtil.closeDBConnection(); ConnectionManagerUtil.closeDBConnection();
} }
} }
@Override @Override public Rating getAppRating(String appReleaseUuid)
public Rating getAppRating(String appReleaseUuid) throws ReviewManagementException, ApplicationManagementException { throws ReviewManagementException, ApplicationManagementException {
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true); int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true);
try { try {
ConnectionManagerUtil.openDBConnection(); ConnectionManagerUtil.openDBConnection();
@ -685,19 +701,22 @@ public class ReviewManagerImpl implements ReviewManager {
rating.setNoOfUsers(ratingValues.size()); rating.setNoOfUsers(ratingValues.size());
rating.setRatingVariety(constructRatingVariety(ratingValues)); rating.setRatingVariety(constructRatingVariety(ratingValues));
return rating; return rating;
} catch (DBConnectionException e) { } catch (DBConnectionException e) {
String msg = "DB Connection error occured while getting app rating of the application which has application " String msg =
+ "release for uuid: " + appReleaseUuid; "DB Connection error occured while getting app rating of the application which has application "
log.error(msg); + "release for uuid: " + appReleaseUuid;
log.error(msg, e);
throw new ReviewManagementException(msg, e); throw new ReviewManagementException(msg, e);
}catch (ApplicationManagementDAOException e) { } catch (ApplicationManagementDAOException e) {
String msg = "Error occured while getting the application DTO for the application release uuid: " + appReleaseUuid; String msg = "Error occured while getting the application DTO for the application release uuid: "
log.error(msg); + appReleaseUuid;
log.error(msg, e);
throw new ReviewManagementException(msg, e); throw new ReviewManagementException(msg, e);
} catch (ReviewManagementDAOException e) { } catch (ReviewManagementDAOException e) {
String msg ="Error occured while getting all rating values of application which has the application release " String msg =
+ "for UUID: " + appReleaseUuid; "Error occured while getting all rating values of application which has the application release "
log.error(msg); + "for UUID: " + appReleaseUuid;
log.error(msg, e);
throw new ReviewManagementException(msg, e); throw new ReviewManagementException(msg, e);
} finally { } finally {
ConnectionManagerUtil.closeDBConnection(); ConnectionManagerUtil.closeDBConnection();
@ -781,7 +800,7 @@ public class ReviewManagerImpl implements ReviewManager {
this.applicationDAO.updateApplicationRating(uuid, appAverageRatingValue, tenantId); this.applicationDAO.updateApplicationRating(uuid, appAverageRatingValue, tenantId);
} catch (ApplicationManagementDAOException e) { } catch (ApplicationManagementDAOException e) {
String msg = "Error occurred when getting application data or updating application rating value."; 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); throw new ApplicationManagementException(msg, e);
} catch (ReviewManagementDAOException e) { } catch (ReviewManagementDAOException e) {
String msg = "Error occurred when getting application rating values"; 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.SubAction;
import org.wso2.carbon.device.application.mgt.common.SubsciptionType; 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.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.ApplicationDTO;
import org.wso2.carbon.device.application.mgt.common.dto.DeviceSubscriptionDTO; import org.wso2.carbon.device.application.mgt.common.dto.DeviceSubscriptionDTO;
import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagementException; 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.exception.TransactionManagementException;
import org.wso2.carbon.device.application.mgt.common.response.Application; 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.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.ApplicationDAO;
import org.wso2.carbon.device.application.mgt.core.dao.SubscriptionDAO; import org.wso2.carbon.device.application.mgt.core.dao.SubscriptionDAO;
import org.wso2.carbon.device.application.mgt.core.dao.common.ApplicationManagementDAOFactory; import org.wso2.carbon.device.application.mgt.core.dao.common.ApplicationManagementDAOFactory;
@ -175,11 +173,11 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
return applicationInstallResponse; return applicationInstallResponse;
} catch (DeviceManagementException e) { } catch (DeviceManagementException e) {
String msg = "Error occurred while getting devices of given users or given roles."; 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); throw new ApplicationManagementException(msg, e);
} catch (GroupManagementException e) { } catch (GroupManagementException e) {
String msg = "Error occurred while getting devices of given groups"; String msg = "Error occurred while getting devices of given groups";
log.error(msg); log.error(msg, e);
throw new ApplicationManagementException(msg, e); throw new ApplicationManagementException(msg, e);
} }
} }
@ -316,12 +314,12 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
return applicationDTO; return applicationDTO;
} catch (LifecycleManagementException e) { } catch (LifecycleManagementException e) {
String msg = "Error occured when getting life-cycle state from life-cycle state manager."; String msg = "Error occured when getting life-cycle state from life-cycle state manager.";
log.error(msg); log.error(msg, e);
throw new ApplicationManagementException(msg); throw new ApplicationManagementException(msg, e);
} catch (ApplicationManagementDAOException e) { } catch (ApplicationManagementDAOException e) {
String msg = "Error occurred while getting application data for application release UUID: " + uuid; String msg = "Error occurred while getting application data for application release UUID: " + uuid;
log.error(msg); log.error(msg, e);
throw new ApplicationManagementException(msg); throw new ApplicationManagementException(msg, e);
} finally { } finally {
ConnectionManagerUtil.closeDBConnection(); ConnectionManagerUtil.closeDBConnection();
} }
@ -393,17 +391,16 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
ConnectionManagerUtil.rollbackDBTransaction(); ConnectionManagerUtil.rollbackDBTransaction();
String msg = "Error occurred when adding subscription data for application release ID: " String msg = "Error occurred when adding subscription data for application release ID: "
+ applicationReleaseId; + applicationReleaseId;
log.error(msg); log.error(msg, e);
throw new ApplicationManagementException(msg, e); throw new ApplicationManagementException(msg, e);
} catch (DBConnectionException e) { } catch (DBConnectionException e) {
String msg = "Error occurred when getting database connection to add new device subscriptions to application."; 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); throw new ApplicationManagementException(msg, e);
} catch (TransactionManagementException e) { } catch (TransactionManagementException e) {
String msg = String msg = "SQL Error occurred when adding new device subscription to application release which has ID: "
"SQL Error occurred when adding new device subscription to application release which has ID: "
+ applicationReleaseId; + applicationReleaseId;
log.error(msg); log.error(msg, e);
throw new ApplicationManagementException(msg, e); throw new ApplicationManagementException(msg, e);
} finally { } finally {
ConnectionManagerUtil.closeDBConnection(); ConnectionManagerUtil.closeDBConnection();
@ -430,16 +427,15 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
return this.subscriptionDAO.getDeviceSubscriptions(filteredDeviceIds, tenantId); return this.subscriptionDAO.getDeviceSubscriptions(filteredDeviceIds, tenantId);
} catch (ApplicationManagementDAOException e) { } catch (ApplicationManagementDAOException e) {
String msg = "Error occured when getting device subscriptions for given device IDs"; String msg = "Error occured when getting device subscriptions for given device IDs";
log.error(msg); log.error(msg, e);
throw new ApplicationManagementException(msg); throw new ApplicationManagementException(msg, e);
} catch (DBConnectionException e) { } catch (DBConnectionException e) {
String msg = "Error occured while getting database connection for getting device subscriptions."; String msg = "Error occured while getting database connection for getting device subscriptions.";
log.error(msg); log.error(msg, e);
throw new ApplicationManagementException(msg); throw new ApplicationManagementException(msg, e);
} finally { } finally {
ConnectionManagerUtil.closeDBConnection(); ConnectionManagerUtil.closeDBConnection();
} }
} }
private Activity addAppOperationOnDevices(ApplicationDTO applicationDTO, private Activity addAppOperationOnDevices(ApplicationDTO applicationDTO,
@ -452,8 +448,9 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
Operation operation = generateOperationPayloadByDeviceType(deviceType, application, action); Operation operation = generateOperationPayloadByDeviceType(deviceType, application, action);
return deviceManagementProviderService.addOperation(deviceType, operation, deviceIdentifierList); return deviceManagementProviderService.addOperation(deviceType, operation, deviceIdentifierList);
} catch (OperationManagementException e) { } catch (OperationManagementException e) {
throw new ApplicationManagementException( String msg = "Error occurred while adding the application install operation to devices";
"Error occurred while adding the application install " + "operation to devices", e); log.error(msg, e);
throw new ApplicationManagementException(msg, e);
} catch (InvalidDeviceException e) { } catch (InvalidDeviceException e) {
//This exception should not occur because the validation has already been done. //This exception should not occur because the validation has already been done.
throw new ApplicationManagementException("The list of device identifiers are invalid"); 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) private Operation generateOperationPayloadByDeviceType(String deviceType, Application application, String action)
throws ApplicationManagementException { throws ApplicationManagementException {
try { try {
//todo rethink and modify the {@link MobileApp} usage //todo rethink and modify the {@link MobileApp} usage
MobileApp mobileApp = new MobileApp(); MobileApp mobileApp = new MobileApp();
MobileAppTypes mobileAppType = MobileAppTypes.valueOf(application.getType()); MobileAppTypes mobileAppType = MobileAppTypes.valueOf(application.getType());
@ -505,8 +501,8 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
} }
} catch (UnknownApplicationTypeException e) { } catch (UnknownApplicationTypeException e) {
String msg = "Unknown Application type is found."; String msg = "Unknown Application type is found.";
log.error(msg); log.error(msg, e);
throw new ApplicationManagementException(msg); throw new ApplicationManagementException(msg, e);
} }
} }
} }

@ -50,9 +50,8 @@ public class LifecycleStateManager {
try { try {
PermissionUtils.putPermission(lifecycleState.getPermission()); PermissionUtils.putPermission(lifecycleState.getPermission());
} catch (PermissionManagementException e) { } catch (PermissionManagementException e) {
String msg = String msg = "Error when adding permission " + lifecycleState.getPermission() + " related to the "
"Error when adding permission " + lifecycleState.getPermission() + " related to the state: " + "state: " + lifecycleState.getName();
+ lifecycleState.getName();
log.error(msg, e); log.error(msg, e);
throw new LifecycleManagementException(msg, e); throw new LifecycleManagementException(msg, e);
} }
@ -94,12 +93,15 @@ public class LifecycleStateManager {
} }
return false; return false;
} catch (UserStoreException e) { } catch (UserStoreException e) {
throw new LifecycleManagementException( String msg = "UserStoreException exception from changing the state from : " + currentState + " to: "
"UserStoreException exception from changing the state from : " + currentState + " to: " + nextState + " with username : " + username + " and tenant Id : " + tenantId;
+ nextState + " with username : " + username + " and tenant Id : " + tenantId, e); log.error(msg, e);
throw new LifecycleManagementException(msg, e);
} }
} else { } 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; List<DeviceType> deviceTypes;
try { try {
deviceTypes = DAOUtil.getDeviceManagementService().getDeviceTypes(); deviceTypes = DAOUtil.getDeviceManagementService().getDeviceTypes();
if (deviceTypeAttr instanceof String) { if (deviceTypeAttr instanceof String) {
for (DeviceType dt : deviceTypes) { for (DeviceType dt : deviceTypes) {
if (dt.getName().equals(deviceTypeAttr)) { if (dt.getName().equals(deviceTypeAttr)) {
@ -209,16 +208,14 @@ public class APIUtil {
log.error(msg); log.error(msg);
throw new BadRequestException(msg); throw new BadRequestException(msg);
} }
String msg = "Invalid device type Attribute is found with the request. Device Type attribute: "
String msg = + deviceTypeAttr;
"Invalid device type Attribute is found with the request. Device Type attribute: " + deviceTypeAttr;
log.error(msg); log.error(msg);
throw new BadRequestException(msg); throw new BadRequestException(msg);
} catch (DeviceManagementException e) { } catch (DeviceManagementException e) {
String msg = "Error occured when getting device types which are supported by the Entgra IoTS"; String msg = "Error occured when getting device types which are supported by the Entgra IoTS";
log.error(msg); log.error(msg, e);
throw new UnexpectedServerErrorException(msg); throw new UnexpectedServerErrorException(msg, e);
} }
} }
@ -409,5 +406,4 @@ public class APIUtil {
return mdmConfig.getArtifactDownloadProtocol() + "://" + host + ":" + port return mdmConfig.getArtifactDownloadProtocol() + "://" + host + ":" + port
+ artifactDownloadEndpoint + Constants.FORWARD_SLASH; + artifactDownloadEndpoint + Constants.FORWARD_SLASH;
} }
} }

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

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

Loading…
Cancel
Save