File tree Expand file tree Collapse file tree
functionalTest/kotlin/io/github/sgtsilvio/gradle/oci
main/kotlin/io/github/sgtsilvio/gradle/oci/internal/dsl Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ internal class CentralRegistryDeclarationTest {
7373 projectDir,
7474 """
7575 dependencyResolutionManagement {
76- repositoriesMode = RepositoriesMode.PREFER_PROJECT
76+ repositoriesMode = RepositoriesMode.PREFER_PROJECT
7777 oci {
7878 registries {
7979 gitHubContainerRegistry {}
Original file line number Diff line number Diff line change @@ -176,17 +176,15 @@ internal abstract class OciRegistriesService : BuildService<BuildServiceParamete
176176 imageMapping : OciImageMappingImpl ,
177177 ) = synchronized(this ) {
178178 if (state != null ) {
179- throw IllegalStateException ()
179+ throw IllegalStateException (" OciRegistriesService.init must be called exactly once immediately after creation " )
180180 }
181181 state = State .Initialized (registries, repositoryPort, imageMapping)
182182 }
183183
184184 fun start () = synchronized(this ) {
185185 val currentState = state
186+ ? : throw IllegalStateException (" OciRegistriesService.start must be called after init" )
186187 if (currentState !is State .Initialized ) {
187- if ((currentState == null ) || (currentState == State .Closed )) {
188- throw IllegalStateException ()
189- }
190188 return
191189 }
192190 if (currentState.registries.isEmpty()) {
@@ -262,6 +260,7 @@ internal abstract class OciRegistriesService : BuildService<BuildServiceParamete
262260
263261 final override fun close () = synchronized(this ) {
264262 val currentState = state
263+ ? : throw IllegalStateException (" OciRegistriesService.close must be called after init" )
265264 if (currentState is State .Started ) {
266265 for (httpServer in currentState.httpServers) {
267266 httpServer.disposeNow()
You can’t perform that action at this time.
0 commit comments