Skip to content

Commit

Permalink
Fixed a bug where the builder did not reset the status after throwing…
Browse files Browse the repository at this point in the history
… an exception
  • Loading branch information
RomanQed committed Feb 21, 2024
1 parent bbe6b28 commit 3167697
Showing 1 changed file with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,7 @@ protected void buildArtifacts(Map<Class<?>, ClassScheme> schemes, LazyProvider p
}
}

@Override
public ServiceProvider build() {
private ServiceProvider uncheckedBuild() {
// Build class schemes
var schemes = makeSchemes();
// Build dependency graph
Expand Down Expand Up @@ -131,4 +130,17 @@ public ServiceProvider build() {
reset();
return new ServiceProviderImpl(repository);
}

@Override
public ServiceProvider build() {
try {
return uncheckedBuild();
} catch (Error | RuntimeException e) {
reset();
throw e;
} catch (Throwable e) {
reset();
throw new RuntimeException(e);
}
}
}

0 comments on commit 3167697

Please sign in to comment.