mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
ACS-2334 improve ArchivedIOException logging (#859)
* ACS-2234: Improving ArchivedIOException logging. * ACS-2234: Improving ArchivedIOException logging. * ACS-2234: Throw WebScriptException wit 412 status code when ArchivedIOException caught. * ACS-2234: Fixing formatting and removing unused import.
This commit is contained in:
@@ -47,6 +47,7 @@ import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
|||||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||||
import org.alfresco.repo.transaction.TooBusyException;
|
import org.alfresco.repo.transaction.TooBusyException;
|
||||||
import org.alfresco.repo.web.scripts.bean.LoginPost;
|
import org.alfresco.repo.web.scripts.bean.LoginPost;
|
||||||
|
import org.alfresco.service.cmr.repository.ArchivedIOException;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.cmr.repository.TemplateService;
|
import org.alfresco.service.cmr.repository.TemplateService;
|
||||||
import org.alfresco.service.cmr.security.AuthorityService;
|
import org.alfresco.service.cmr.security.AuthorityService;
|
||||||
@@ -506,6 +507,10 @@ public class RepositoryContainer extends AbstractRuntimeContainer
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (ArchivedIOException e) // handle ArchivedIOException to lower log pollution
|
||||||
|
{
|
||||||
|
handleArchivedIOException(e);
|
||||||
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
handleIOException(e);
|
handleIOException(e);
|
||||||
@@ -606,6 +611,10 @@ public class RepositoryContainer extends AbstractRuntimeContainer
|
|||||||
// Map TooBusyException to a 503 status code
|
// Map TooBusyException to a 503 status code
|
||||||
throw new WebScriptException(HttpServletResponse.SC_SERVICE_UNAVAILABLE, e.getMessage(), e);
|
throw new WebScriptException(HttpServletResponse.SC_SERVICE_UNAVAILABLE, e.getMessage(), e);
|
||||||
}
|
}
|
||||||
|
catch (ArchivedIOException e) // handle ArchivedIOException to lower log pollution
|
||||||
|
{
|
||||||
|
handleArchivedIOException(e);
|
||||||
|
}
|
||||||
|
|
||||||
// Ensure a response is always flushed after successful execution
|
// Ensure a response is always flushed after successful execution
|
||||||
if (bufferedRes != null)
|
if (bufferedRes != null)
|
||||||
@@ -615,6 +624,19 @@ public class RepositoryContainer extends AbstractRuntimeContainer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void handleArchivedIOException(ArchivedIOException e)
|
||||||
|
{
|
||||||
|
if (logger.isDebugEnabled()) // log with stack trace at debug level
|
||||||
|
{
|
||||||
|
logger.debug("ArchivedIOException error ", e);
|
||||||
|
}
|
||||||
|
else if (logger.isInfoEnabled()) // log without stack trace at info level
|
||||||
|
{
|
||||||
|
logger.info("ArchivedIOException error. Message: " + e.getMessage());
|
||||||
|
}
|
||||||
|
throw new WebScriptException(HttpServletResponse.SC_PRECONDITION_FAILED, "Content is archived and not accessible.");
|
||||||
|
}
|
||||||
|
|
||||||
private static void handleIOException(final IOException ioe) throws IOException
|
private static void handleIOException(final IOException ioe) throws IOException
|
||||||
{
|
{
|
||||||
Throwable socketException = ExceptionStackUtil.getCause(ioe, SocketException.class);
|
Throwable socketException = ExceptionStackUtil.getCause(ioe, SocketException.class);
|
||||||
|
Reference in New Issue
Block a user