mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Fixed major issues (Use Correct Exception Logging) reported in Sonar
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@89722 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -239,7 +239,7 @@ public class RecordsManagementAdminBase implements RecordsManagementCustomModel
|
|||||||
}
|
}
|
||||||
catch (DictionaryException de)
|
catch (DictionaryException de)
|
||||||
{
|
{
|
||||||
logger.warn("readCustomContentModel: skip model ("+modelRef+") whilst searching for uri ("+uri+"): "+de);
|
logger.warn("readCustomContentModel: skip model ("+modelRef+") whilst searching for uri ("+uri+"): ", de);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -9,7 +9,6 @@ import org.alfresco.module.org_alfresco_module_rm.model.rma.type.RmSiteType;
|
|||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.cmr.site.SiteService;
|
import org.alfresco.service.cmr.site.SiteService;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.commons.lang.exception.ExceptionUtils;
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.springframework.extensions.webscripts.Cache;
|
import org.springframework.extensions.webscripts.Cache;
|
||||||
@@ -22,7 +21,7 @@ public class DataSetPost extends DeclarativeWebScript implements RecordsManageme
|
|||||||
{
|
{
|
||||||
/** Constant for the site name parameter */
|
/** Constant for the site name parameter */
|
||||||
private static final String ARG_SITE_NAME = "site";
|
private static final String ARG_SITE_NAME = "site";
|
||||||
|
|
||||||
/** Constant for the data set id parameter */
|
/** Constant for the data set id parameter */
|
||||||
private static final String ARG_DATA_SET_ID = "dataSetId";
|
private static final String ARG_DATA_SET_ID = "dataSetId";
|
||||||
|
|
||||||
@@ -37,7 +36,7 @@ public class DataSetPost extends DeclarativeWebScript implements RecordsManageme
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set site service
|
* Set site service
|
||||||
*
|
*
|
||||||
* @param siteService the site service
|
* @param siteService the site service
|
||||||
*/
|
*/
|
||||||
public void setSiteService(SiteService siteService)
|
public void setSiteService(SiteService siteService)
|
||||||
@@ -47,7 +46,7 @@ public class DataSetPost extends DeclarativeWebScript implements RecordsManageme
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Data set service
|
* Data set service
|
||||||
*
|
*
|
||||||
* @param dataSetService the data set service
|
* @param dataSetService the data set service
|
||||||
*/
|
*/
|
||||||
public void setDataSetService(DataSetService dataSetService)
|
public void setDataSetService(DataSetService dataSetService)
|
||||||
@@ -77,21 +76,21 @@ public class DataSetPost extends DeclarativeWebScript implements RecordsManageme
|
|||||||
throw new WebScriptException(Status.STATUS_NOT_FOUND, "A data set with the id '" + dataSetId + "'"
|
throw new WebScriptException(Status.STATUS_NOT_FOUND, "A data set with the id '" + dataSetId + "'"
|
||||||
+ " does not exist.");
|
+ " does not exist.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resolve RM site
|
// Resolve RM site
|
||||||
String siteName = req.getParameter(ARG_SITE_NAME);
|
String siteName = req.getParameter(ARG_SITE_NAME);
|
||||||
if (StringUtils.isBlank(siteName))
|
if (StringUtils.isBlank(siteName))
|
||||||
{
|
{
|
||||||
siteName = RmSiteType.DEFAULT_SITE_NAME;
|
siteName = RmSiteType.DEFAULT_SITE_NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check the site if it exists
|
// Check the site if it exists
|
||||||
if (siteService.getSite(siteName) == null)
|
if (siteService.getSite(siteName) == null)
|
||||||
{
|
{
|
||||||
throw new WebScriptException(Status.STATUS_BAD_REQUEST, "A Records Management site with the name '"
|
throw new WebScriptException(Status.STATUS_BAD_REQUEST, "A Records Management site with the name '"
|
||||||
+ siteName + "' does not exist.");
|
+ siteName + "' does not exist.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resolve documentLibrary (filePlan) container
|
// Resolve documentLibrary (filePlan) container
|
||||||
NodeRef filePlan = siteService.getContainer(siteName, RmSiteType.COMPONENT_DOCUMENT_LIBRARY);
|
NodeRef filePlan = siteService.getContainer(siteName, RmSiteType.COMPONENT_DOCUMENT_LIBRARY);
|
||||||
if (filePlan == null)
|
if (filePlan == null)
|
||||||
@@ -99,7 +98,7 @@ public class DataSetPost extends DeclarativeWebScript implements RecordsManageme
|
|||||||
filePlan = siteService.createContainer(siteName, RmSiteType.COMPONENT_DOCUMENT_LIBRARY,
|
filePlan = siteService.createContainer(siteName, RmSiteType.COMPONENT_DOCUMENT_LIBRARY,
|
||||||
TYPE_FILE_PLAN, null);
|
TYPE_FILE_PLAN, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load data set in to the file plan
|
// Load data set in to the file plan
|
||||||
dataSetService.loadDataSet(filePlan, dataSetId);
|
dataSetService.loadDataSet(filePlan, dataSetId);
|
||||||
|
|
||||||
@@ -110,7 +109,7 @@ public class DataSetPost extends DeclarativeWebScript implements RecordsManageme
|
|||||||
{
|
{
|
||||||
model.put("success", false);
|
model.put("success", false);
|
||||||
model.put("message", ex.getMessage());
|
model.put("message", ex.getMessage());
|
||||||
logger.error(ExceptionUtils.getFullStackTrace(ex));
|
logger.error("Error while importing data set: " + ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
return model;
|
return model;
|
||||||
|
Reference in New Issue
Block a user