Skip to content

Commit 320b268

Browse files
committed
Fix duplicate execution of the promote validations
Seems we did not remove duplicate for verify store keys, which may include duplicates. For example if target store and "availableInStores" parameters are same.
1 parent c73a5aa commit 320b268

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

addons/promote/common/src/main/java/org/commonjava/indy/promote/validate/PromotionValidationTools.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ public StoreKey[] getValidationStoreKeys( final ValidationRequest request, final
168168
Logger logger = LoggerFactory.getLogger( getClass() );
169169
logger.debug( "Got extra validation keys string: '{}'", verifyStores );
170170

171-
List<StoreKey> verifyStoreKeys = new ArrayList<>();
171+
Set<StoreKey> verifyStoreKeys = new HashSet<>();
172172
if ( includeSource )
173173
{
174174
verifyStoreKeys.add( request.getSourceRepository().getKey() );
@@ -204,7 +204,7 @@ public StoreKey[] getValidationStoreKeys( final ValidationRequest request, final
204204

205205
logger.debug( "Using validation StoreKeys: {}", verifyStoreKeys );
206206

207-
return verifyStoreKeys.toArray( new StoreKey[verifyStoreKeys.size()] );
207+
return verifyStoreKeys.toArray( new StoreKey[0] );
208208
}
209209

210210
public String toArtifactPath( final ProjectVersionRef ref )
@@ -676,19 +676,19 @@ private void waitForCompletion( CountDownLatch latch )
676676
public <T> void forEach( Collection<T> collection, Closure closure )
677677
{
678678
logger.trace( "Exe on collection {} with closure {}", collection, closure );
679-
collection.forEach( e -> closure.call( e ) );
679+
collection.forEach( closure::call );
680680
}
681681

682682
public <T> void forEach( T[] array, Closure closure )
683683
{
684684
logger.trace( "Exe on array {} with closure {}", array, closure );
685-
Arrays.asList( array ).forEach( e -> closure.call( e ) );
685+
Arrays.asList( array ).forEach( closure::call );
686686
}
687687

688688
public <K, V> void forEach( Map<K, V> map, Closure closure )
689689
{
690690
Set<Map.Entry<K, V>> entries = map.entrySet();
691691
logger.trace( "Exe on map {} with closure {}", entries, closure );
692-
entries.forEach( e -> closure.call( e ) );
692+
entries.forEach( closure::call );
693693
}
694694
}

0 commit comments

Comments
 (0)