improve exception handling in security cache management
@@ -1332,16 +1332,19 @@ public class OSecurityShared implements OSecurityInternal {
return;
}
OSecurityUser user = session.getUser();
+ try {
if (user != null) {
((ODatabaseDocumentInternal) session).setUser(null);
}
initPredicateSecurityOptimizationsInternal(session);
+ } finally {
if (user != null) {
((ODatabaseDocumentInternal) session).setUser(user);
}
}
+ }
private void initPredicateSecurityOptimizationsInternal(ODatabaseSession session) {
Map<String, Map<String, Boolean>> result = new HashMap<>();
@@ -1815,6 +1818,7 @@ public class OSecurityShared implements OSecurityInternal {
protected void updateAllFilteredPropertiesInternal(ODatabaseDocumentInternal session) {
OSecurityUser user = session.getUser();
+ try {
if (user != null) {
session.setUser(null);
}
@@ -1823,10 +1827,12 @@ public class OSecurityShared implements OSecurityInternal {
filteredProperties.clear();
filteredProperties.addAll(calculateAllFilteredProperties(session));
}
+ } finally {
if (user != null) {
session.setUser(user);
}
}
+ }
protected Set<OSecurityResourceProperty> calculateAllFilteredProperties(
ODatabaseSession session) {
