Source:
private List<String> checkRegisteredAttributesModules(PerunSession session, List<String> messages, List<String> alreadyResolvedMessages) { List<String> addedResolvedMessages = new ArrayList<>(); for(String message: messages) { for(VirtualAttributesModuleImplApi virtAttrModuleImplApi : registeredAttributesModules) { log.info("Message is given to module {}", message, virtAttrModuleImplApi.getClass().getSimpleName()); try { addedResolvedMessages.addAll(virtAttrModuleImplApi.resolveVirtualAttributeValueChange((PerunSessionImpl) session, message)); } catch (InternalErrorException ex) { log.error("Error when auditer trying to resolve messages in modules.", ex); } catch (WrongAttributeAssignmentException ex) { log.error("Error when auditer trying to resolve messages in modules.", ex); } catch (WrongReferenceAttributeValueException ex) { log.error("Error when auditer trying to resolve messages in modules.", ex); } catch (AttributeNotExistsException ex) { log.error("Error when auditer trying to resolve messages in modules.", ex); } catch (Exception ex) { log.error("An unexpected exception happened when trying to resolve message: in module {}, exception: {}", message, virtAttrModuleImplApi.getAttributeDefinition().getFriendlyName(), ex); } } } if(!addedResolvedMessages.isEmpty()) { for(String addedResolvedMessage: addedResolvedMessages) { if(alreadyResolvedMessages.contains(addedResolvedMessage)) { log.error("There is a cycle for resolving message {}. Recursion was stopped forcibly and more resolving messages was not generated! " + "For this reason, some of them may be missing!", addedResolvedMessage); return alreadyResolvedMessages; } } alreadyResolvedMessages.addAll(addedResolvedMessages); return checkRegisteredAttributesModules(session, addedResolvedMessages, alreadyResolvedMessages); } return alreadyResolvedMessages; }

Target:
private List<String> checkRegisteredAttributesModules(PerunSession session, List<String> messages, List<String> alreadyResolvedMessages) { List<String> addedResolvedMessages = new ArrayList<>(); for(String message: messages) { for(VirtualAttributesModuleImplApi virtAttrModuleImplApi : registeredAttributesModules) { log.info("Message is given to module {}", message, virtAttrModuleImplApi.getClass().getSimpleName()); try { addedResolvedMessages.addAll(virtAttrModuleImplApi.resolveVirtualAttributeValueChange((PerunSessionImpl) session, message)); } catch (InternalErrorException ex) { log.error("Error when auditer trying to resolve messages in modules.", ex); } catch (WrongAttributeAssignmentException ex) { log.error("Error when auditer trying to resolve messages in modules.", ex); } catch (WrongReferenceAttributeValueException ex) { log.error("Error when auditer trying to resolve messages in modules.", ex); } catch (AttributeNotExistsException ex) { log.error("Error when auditer trying to resolve messages in modules.", ex); } catch (Exception ex) { log.error("An unexpected exception happened when trying to resolve message: in module {}, exception: {}", message, virtAttrModuleImplApi.getAttributeDefinition().getFriendlyName(), ex); } } } if(!addedResolvedMessages.isEmpty()) { Iterator<String> msgIterator = addedResolvedMessages.iterator(); while(msgIterator.hasNext()) { String addedResolvedMessage = msgIterator.next(); if(alreadyResolvedMessages.contains(addedResolvedMessage)) { log.error("There is a cycle for resolving message {}. This message won't be processed more than once!", addedResolvedMessage); msgIterator.remove(); } } alreadyResolvedMessages.addAll(addedResolvedMessages); return checkRegisteredAttributesModules(session, addedResolvedMessages, alreadyResolvedMessages); } return alreadyResolvedMessages; }