@@ -56,8 +56,9 @@ public ExtendedStatus getAndCachePatchStatus(String coords, CachedStatuses cache
5656 }
5757
5858 public ExtendedStatus getAndCacheStatus (Component comp , CachedStatuses cache , IProgress progress , boolean patch ) {
59+ VCSRepository repo = null ;
5960 try {
60- VCSRepository repo = repoFactory .getVCSRepository (comp );
61+ repo = repoFactory .getVCSRepository (comp );
6162 ExtendedStatus existing = cache .putIfAbsent (repo .getUrl (), ExtendedStatus .DUMMY );
6263
6364 while (ExtendedStatus .DUMMY == existing ) {
@@ -83,14 +84,17 @@ public ExtendedStatus getAndCacheStatus(Component comp, CachedStatuses cache, IP
8384 cache .replace (repo .getUrl (), res );
8485 return res ;
8586 } catch (Exception e ) {
87+ if (repo != null ) {
88+ cache .remove (repo .getUrl ());
89+ }
8690 if (e instanceof EReleaserException ) {
8791 throw e ;
8892 }
8993 throw new EBuildStatus (e , comp );
9094 }
9195 }
9296
93- private ExtendedStatus getMinorStatus (Component comp , CachedStatuses cache , IProgress progress , VCSRepository repo , DelayedTag dt ) {
97+ ExtendedStatus getMinorStatus (Component comp , CachedStatuses cache , IProgress progress , VCSRepository repo , DelayedTag dt ) {
9498 ReleaseBranchCurrent rb = reportDuration (() -> ReleaseBranchFactory .getCRB (repo ), "CRB created" , comp , progress );
9599 Boolean hasDelayedTag = dt != null && rb .getName ().equals (Utils .getReleaseBranchName (repo , dt .getVersion ()));
96100 LinkedHashMap <Component , ExtendedStatus > subComponents = new LinkedHashMap <>();
@@ -154,14 +158,7 @@ private ExtendedStatus getPatchStatus(Component comp, CachedStatuses cache, IPro
154158 }
155159
156160 ConcurrentHashMap <Component , ExtendedStatus > subComponentsLocal = new ConcurrentHashMap <>();
157- Utils .async (rb .getMDeps (), (mdep ) -> {
158- try {
159- recursiveGetAndCacheStatus (cache , progress , subComponentsLocal , mdep , true );
160- } catch (Exception e ) {
161- cache .remove (repo .getUrl ());
162- throw e ;
163- }
164- });
161+ Utils .async (rb .getMDeps (), (mdep ) -> recursiveGetAndCacheStatus (cache , progress , subComponentsLocal , mdep , true ));
165162 for (Component mdep : rb .getMDeps ()) {
166163 subComponents .put (mdep , subComponentsLocal .get (mdep ));
167164 }
@@ -254,7 +251,6 @@ private boolean areMDepsPatchesActualForPatch(Component rootComp, VCSRepository
254251
255252 // Any component `nextVersion`.truncatePatch is not equal to one mentioned in `mdeps` -> error (disallow minor upgrade/downgrade)
256253 if (!nextVersion .toReleaseNoPatch ().equals (mDep .getVersion ().toReleaseNoPatch ())) {
257- cache .remove (repo .getUrl ());
258254 throw new EMinorUpgradeDowngrade (rootComp , mDep , nextVersion .toPreviousPatch ());
259255 }
260256
@@ -271,7 +267,6 @@ private boolean areMDepsPatchesActualForPatch(Component rootComp, VCSRepository
271267
272268 // Any component `nextVersion`.patch is less than one mentioned in `mdeps` -> error (patch upgrade only is allowed)
273269 if (nextVersionPatch < mDepPatch ) {
274- cache .remove (repo .getUrl ());
275270 throw new EMinorUpgradeDowngrade (rootComp , mDep , verToActualizeOn );
276271 }
277272
@@ -337,13 +332,6 @@ private Boolean isNeedToFork(Component comp, ReleaseBranchCurrent rb, CachedStat
337332 }
338333
339334 private void recursiveGetAndCacheStatusAsync (ReleaseBranchCurrent rb , CachedStatuses cache , IProgress progress , VCSRepository repo , ConcurrentHashMap <Component , ExtendedStatus > subComponentsLocal ) {
340- Utils .async (rb .getMDeps (), (mdep ) -> {
341- try {
342- recursiveGetAndCacheStatus (cache , progress , subComponentsLocal , mdep , false );
343- } catch (Exception e ) {
344- cache .remove (repo .getUrl ());
345- throw e ;
346- }
347- });
335+ Utils .async (rb .getMDeps (), (mdep ) -> recursiveGetAndCacheStatus (cache , progress , subComponentsLocal , mdep , false ));
348336 }
349337}
0 commit comments