} catch (Exception e) {
throw new IllegalArgumentException("Invalid URI, no LanguageResolver registered for scheme: " + name, e);
}
if (type != null) {
if (LanguageResolver.class.isAssignableFrom(type)) {
LanguageResolver resolver = (LanguageResolver)context.getInjector().newInstance(type);
return resolver.resolveLanguage(name, context);
} else {
throw new IllegalArgumentException("Resolving language: " + name + " detected type conflict: Not a LanguageResolver implementation. Found: " + type.getName());
}
}
throw new NoSuchLanguageException(name);