Add debug log message if exceptions are swallowed.

Fix a couple of minor issues in DynamicAuthoritiesGet webscript.
This commit is contained in:
Tom Page
2018-01-12 15:04:07 +00:00
parent db4871fd8d
commit 9becfe79a5
3 changed files with 22 additions and 4 deletions

View File

@@ -60,6 +60,8 @@ import org.apache.commons.lang.StringUtils;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.extensions.surf.util.I18NUtil;
/**
@@ -71,6 +73,8 @@ import org.springframework.extensions.surf.util.I18NUtil;
public class FilePlanRoleServiceImpl implements FilePlanRoleService,
RecordsManagementModel
{
/** Logger for the class. */
private static final Logger LOGGER = LoggerFactory.getLogger(FilePlanRoleServiceImpl.class);
/** I18N */
private static final String MSG_ALL_ROLES = "rm.role.all";
@@ -394,7 +398,14 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService,
}
finally
{
try {is.close();} catch (IOException e) {}
try
{
is.close();
}
catch (IOException e)
{
LOGGER.debug("Ignoring failed attempt to close stream.", e);
}
}
return sb.toString();

View File

@@ -53,6 +53,8 @@ import org.alfresco.service.namespace.QName;
import org.alfresco.util.Pair;
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.extensions.webscripts.Cache;
import org.springframework.extensions.webscripts.DeclarativeWebScript;
import org.springframework.extensions.webscripts.Status;
@@ -66,6 +68,8 @@ import org.springframework.extensions.webscripts.WebScriptRequest;
*/
public class RMSearchGet extends DeclarativeWebScript
{
/** Logger for the class. */
private static final Logger LOGGER = LoggerFactory.getLogger(RMSearchGet.class);
/** URL Parameters */
private static final String PARAM_QUERY = "query";
private static final String PARAM_SORTBY = "sortby";
@@ -211,7 +215,10 @@ public class RMSearchGet extends DeclarativeWebScript
Item item = new Item(pair.getFirst(), pair.getSecond());
items.add(item);
}
catch(Exception e) {}
catch(Exception e)
{
LOGGER.debug("Ignoring failed attempt to add item to search results.", e);
}
}
// Return model

View File

@@ -358,7 +358,7 @@ public class DynamicAuthoritiesGet extends AbstractWebScript implements RecordsM
res.getWriter().write(")");
}
}
catch (Throwable e)
catch (Exception e)
{
if (logger.isDebugEnabled())
{
@@ -416,7 +416,7 @@ public class DynamicAuthoritiesGet extends AbstractWebScript implements RecordsM
protected Long getBatchSizeParameter(WebScriptRequest req)
{
String batchSizeStr = req.getParameter(BATCH_SIZE);
Long size = 0L;
Long size;
if (StringUtils.isBlank(batchSizeStr))
{
logger.info(MESSAGE_BATCHSIZE_IS_MANDATORY);