Source:
ScriptGraph validate() throws InvalidResourceException { for (ScriptGroup group : loadGroups.values()) { Set<ResourceId> deps = group.getDependencies(); for (ResourceId depId : deps) { if (!resources.get(depId.getScope()).containsKey(depId.getName())) { throw new InvalidResourceException("Inconsistent ScriptGraph: ScriptGroup '"+ group.getId() +"' contains unavailable resource '"+ depId +"'."); } } if (deps.isEmpty()) { throw new InvalidResourceException("Inconsistent ScriptGraph: ScriptGroup '"+ group.getId() +"' is empty."); } } for (ResourceScope scope : ResourceScope.values()) { for (ScriptResource resource : resources.get(scope).values()) { ScriptGroup resourceGroup = resource.getGroup(); if (resourceGroup != null) { ScriptGroup loadGroup = loadGroups.get(resourceGroup.getId().getName()); if (loadGroup == null) { throw new InvalidResourceException("Inconsistent ScriptGraph: ScriptGroup '"+ resourceGroup.getId() +"' of resource '"+ resource.getId() +"' is not registered in loadGroups map."); } if (!loadGroup.getDependencies().contains(resource.getId())) { throw new InvalidResourceException("Inconsistent ScriptGraph: ScriptGroup '"+ resourceGroup.getId() +"' does not contain '"+ resource.getId() +"'. It definitely should because '"+ resourceGroup.getId() +"' refers to group '"+ resourceGroup.getId() +"' in its group field."); } } for (ResourceId depId : resource.getDependencies()) { if (!resources.get(depId.getScope()).containsKey(depId.getName())) { throw new InvalidResourceException("Inconsistent ScriptGraph: ScriptResource '"+ resource.getId() +"' depends on a non-existent resource '"+ depId +"'."); } } for (ResourceId depId : resource.getClosure()) { if (!resources.get(depId.getScope()).containsKey(depId.getName())) { throw new InvalidResourceException("Inconsistent ScriptGraph: ScriptResource '"+ resource.getId() +"' contains on a non-existent resource '"+ depId +"' in its closure."); } } } } return this; }

Target:
ScriptGraph validate() throws InvalidResourceException { for (ScriptGroup group : loadGroups.values()) { Set<ResourceId> deps = group.getDependencies(); for (ResourceId depId : deps) { if (!resources.get(depId.getScope()).containsKey(depId.getName())) { throw new InvalidResourceException("Inconsistent ScriptGraph: ScriptGroup '"+ group.getId() +"' contains unavailable resource '"+ depId +"'."); } } if (deps.isEmpty()) { throw new InvalidResourceException("Inconsistent ScriptGraph: ScriptGroup '"+ group.getId() +"' is empty."); } } for (ResourceScope scope : ResourceScope.values()) { for (ScriptResource resource : resources.get(scope).values()) { ScriptGroup resourceGroup = resource.getGroup(); if (resourceGroup != null) { ScriptGroup loadGroup = loadGroups.get(resourceGroup.getId().getName()); if (loadGroup == null) { throw new InvalidResourceException("Inconsistent ScriptGraph: ScriptGroup '"+ resourceGroup.getId() +"' of resource '"+ resource.getId() +"' is not registered in loadGroups map."); } if (!loadGroup.getDependencies().contains(resource.getId())) { throw new InvalidResourceException("Inconsistent ScriptGraph: ScriptGroup '"+ resourceGroup.getId() +"' does not contain '"+ resource.getId() +"'. It definitely should because '"+ resourceGroup.getId() +"' refers to group '"+ resourceGroup.getId() +"' in its group field."); } } for (ResourceId depId : resource.getDependencies()) { if (!resources.get(depId.getScope()).containsKey(depId.getName()) && !JavascriptConfigService.RESERVED_MODULE.contains(depId.getName())) { if (log.isWarnEnabled()) { log.warn("Inconsistent ScriptGraph: ScriptResource '"+ resource.getId() +"' depends on a non-existent resource '"+ depId +"'."); } } } for (ResourceId depId : resource.getClosure()) { if (!resources.get(depId.getScope()).containsKey(depId.getName())) { throw new InvalidResourceException("Inconsistent ScriptGraph: ScriptResource '"+ resource.getId() +"' contains on a non-existent resource '"+ depId +"' in its closure."); } } } } return this; }