TemplateResource () { TemplateResource resource = findTemplateByName(myState.defaultTemplateName); if (resource != null) { return resource; } String initialTemplateName = getInitialTemplateName(); resource = initialTemplateName != null ? findTemplateByName(initialTemplateName) : null; if (resource == null) { return getAllTemplates().iterator().next(); } return resource; }