Fixed bug

This commit is contained in:
Philipp Czora
2019-01-03 14:45:19 +01:00
parent 8c5aab39b1
commit 3497ffddae

View File

@@ -61,7 +61,12 @@ public final class LinkEnricherContext {
* @return instance
*/
public <T> T oneRequireByType(Class<T> type) {
return oneByType(type).get();
Optional<T> instance = oneByType(type);
if (instance.isPresent()) {
return instance.get();
} else {
throw new NoSuchElementException("No instance for given type present");
}
}
}