mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
[MNT-21901] Prevent update preferences concurrency errors (#821)
* [MNT-21901] Added PersistenceException to retry exceptions. Added validation to get retry cause * [MNT-21901] Check exception message only if it is JavaScriptException * [MNT-21901] Removed unit test from repository. Added new test on remote-api. Changed ExceptionStackUtil validation. * [MNT-21901] Improved JavascriptException validation. Added exception delimiter to prevent accepting exceptions with the same partial name.
This commit is contained in:
@@ -25,6 +25,9 @@ package org.alfresco.error;
|
||||
*/
|
||||
public class ExceptionStackUtil
|
||||
{
|
||||
private static final String JAVASCRIPT_EXCEPTION = "org.mozilla.javascript.JavaScriptException";
|
||||
private static final String EXCEPTION_DELIMITER = ":";
|
||||
|
||||
/**
|
||||
* Searches through the exception stack of the given throwable to find any instance
|
||||
* of the possible cause. The top-level throwable will also be tested.
|
||||
@@ -38,10 +41,17 @@ public class ExceptionStackUtil
|
||||
{
|
||||
while (throwable != null)
|
||||
{
|
||||
Class<?> throwableClass = throwable.getClass();
|
||||
|
||||
boolean isJavaScriptException = throwableClass.getName().contains(JAVASCRIPT_EXCEPTION);
|
||||
String throwableMsg = throwable.getMessage() != null ? throwable.getMessage() : "";
|
||||
|
||||
for (Class<?> possibleCauseClass : possibleCauses)
|
||||
{
|
||||
Class<?> throwableClass = throwable.getClass();
|
||||
if (possibleCauseClass.isAssignableFrom(throwableClass))
|
||||
String possibleCauseClassName = possibleCauseClass.getName();
|
||||
|
||||
if (possibleCauseClass.isAssignableFrom(throwableClass)
|
||||
|| (isJavaScriptException && throwableMsg.contains(possibleCauseClassName + EXCEPTION_DELIMITER)))
|
||||
{
|
||||
// We have a match
|
||||
return throwable;
|
||||
|
Reference in New Issue
Block a user