Source:
public List<Attribute> getRequiredAttributes(PerunSession sess, Resource resourceToGetServicesFrom, Host host) throws InternalErrorException { List<Attribute> attributesCache = null; if(!CacheManager.isCacheDisabled() && !perun.getCacheManager().wasCacheUpdatedInTransaction()) { List<Integer> attrIds = getRequiredAttributeIds(resourceToGetServicesFrom); List<Attribute> attrs = perun.getCacheManager().getAttributesByIds(attrIds, new Holder(host.getId(), Holder.HolderType.HOST)); attributesCache = this.setValuesOfAttributes(sess, attrs, host, null); } try { List<Attribute> attributesDB = jdbc.query("select " + getAttributeMappingSelectQuery("host") + " from attr_names " + "left join host_attr_values host on attr_names.id=host.attr_id and host_id=? " + "where namespace in (?,?,?) " + "and attr_names.id in (select distinct service_required_attrs.attr_id from service_required_attrs " + "join resource_services on service_required_attrs.service_id=resource_services.service_id and resource_services.resource_id=?)", new SingleBeanAttributeRowMapper<>(sess, this, host), host.getId(), AttributesManager.NS_HOST_ATTR_CORE, AttributesManager.NS_HOST_ATTR_DEF, AttributesManager.NS_HOST_ATTR_OPT, resourceToGetServicesFrom.getId()); String message = "The attributes do not match, attributes from cache are: " + attributesCache + " while attributes from db are: " + attributesDB + " the attributes belong to " + host + " from service with resource: " + resourceToGetServicesFrom; compareAttributesFromCacheAndDB(attributesCache, attributesDB, message); return attributesDB; } catch (EmptyResultDataAccessException ex) { return new ArrayList<>(); } catch (RuntimeException ex) { throw new InternalErrorException(ex); } }

Target:
public List<Attribute> getRequiredAttributes(PerunSession sess, Resource resourceToGetServicesFrom, Host host) throws InternalErrorException { List<Attribute> attributesCache = null; if(!CacheManager.isCacheDisabled() && !perun.getCacheManager().wasCacheUpdatedInTransaction()) { List<Integer> attrIds = getRequiredAttributeIds(resourceToGetServicesFrom); List<Attribute> attrs = perun.getCacheManager().getAttributesByIds(attrIds, new Holder(host.getId(), Holder.HolderType.HOST)); attributesCache = this.setValuesOfAttributes(sess, attrs, host, null); } try { List<Attribute> attributesDB = jdbc.query("select " + getAttributeMappingSelectQuery("host") + " from attr_names " + "left join host_attr_values host on attr_names.id=host.attr_id and host_id=? " + "where namespace in (?,?,?) " + "and attr_names.id in (select distinct service_required_attrs.attr_id from service_required_attrs " + "join resource_services on service_required_attrs.service_id=resource_services.service_id and resource_services.resource_id=?)", new SingleBeanAttributeRowMapper<>(sess, this, host), host.getId(), AttributesManager.NS_HOST_ATTR_CORE, AttributesManager.NS_HOST_ATTR_DEF, AttributesManager.NS_HOST_ATTR_OPT, resourceToGetServicesFrom.getId()); compareAttributesFromCacheAndDB(attributesCache, attributesDB, host, null); return attributesDB; } catch (EmptyResultDataAccessException ex) { return new ArrayList<>(); } catch (RuntimeException ex) { throw new InternalErrorException(ex); } }