Skip to content

Commit

Permalink
Fixed returning unmodifiable list
Browse files Browse the repository at this point in the history
Signed-off-by: Arjan Tijms <arjan.tijms@gmail.com>
  • Loading branch information
arjantijms committed May 28, 2022
1 parent a8b89ad commit ec6c52c
Showing 1 changed file with 4 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@

package com.sun.enterprise.v3.server;

import static java.util.Collections.emptyList;

import java.net.URI;
import java.util.ArrayList;
import java.util.Collection;
Expand Down Expand Up @@ -120,7 +118,7 @@ public Collection<Sniffer> getSniffers(DeploymentContext context, List<URI> uris

// In their natural order.
// Scan for registered annotations and retrieve applicable sniffers
List<Sniffer> appSniffers = this.getApplicableSniffers(context, uris, types, regularSniffers, true);
List<Sniffer> appSniffers = getApplicableSniffers(context, uris, types, regularSniffers, true);

// Call handles method of the sniffers
for (Sniffer sniffer : regularSniffers) {
Expand All @@ -133,16 +131,11 @@ public Collection<Sniffer> getSniffers(DeploymentContext context, List<URI> uris
}

private <T extends Sniffer> List<T> getApplicableSniffers(DeploymentContext context, List<URI> uris, Types types, Collection<T> sniffers, boolean checkPath) {
ArchiveType archiveType = serviceLocator.getService(ArchiveType.class, context.getArchiveHandler().getArchiveType());

if (sniffers == null || sniffers.isEmpty()) {
return emptyList();
}

if (types == null || types.getAllTypes().isEmpty()) {
return emptyList();
if (sniffers == null || sniffers.isEmpty() || types == null || types.getAllTypes().isEmpty()) {
return new ArrayList<T>();
}

ArchiveType archiveType = serviceLocator.getService(ArchiveType.class, context.getArchiveHandler().getArchiveType());
List<T> applicableSniffers = new ArrayList<T>();

for (T sniffer : sniffers) {
Expand Down

0 comments on commit ec6c52c

Please sign in to comment.