private <T extends IBaseResource> T tryToLoad(Class<T> theType, IIdType theReference, List<ValidationMessage> theMessages) { if (myResourceLoader == null) { theMessages.add(new ValidationMessage().setLevel(IssueSeverity.FATAL) .setMessage("No resource loader present, could not load " + theReference)); return null; } try { T retVal = myResourceLoader.load(theType, theReference); if (retVal == null) { throw new IllegalStateException( "ResourceLoader returned null. This is a bug with the resourceloader. Reference was: " + theReference); } return retVal; } catch (ResourceNotFoundException e) { theMessages.add(new ValidationMessage().setLevel(IssueSeverity.FATAL) .setMessage("Reference could not be found: " + theReference)); return null; } }
private <T extends IBaseResource> T tryToLoad(Class<T> theType, IIdType theReference, List<ValidationMessage> theMessages) { if (myResourceLoader == null) { theMessages.add(new ValidationMessage().setLevel(IssueSeverity.FATAL) .setMessage("No resource loader present, could not load " + theReference)); return null; } try { T retVal = myResourceLoader.load(theType, theReference); if (retVal == null) { throw new IllegalStateException( "ResourceLoader returned null. This is a bug with the resourceloader. Reference was: " + theReference); } return retVal; } catch (ResourceNotFoundException e) { theMessages.add(new ValidationMessage().setLevel(IssueSeverity.FATAL) .setMessage("Reference could not be found: " + theReference)); return null; } }