Skip to content

Commit

Permalink
Merge pull request payara#6786 from Pandrex247/FISH-8736
Browse files Browse the repository at this point in the history
FISH-8736 Fix for Web Services Engine Inconsistently Starting
  • Loading branch information
Pandrex247 committed Aug 13, 2024
1 parent c6761bf commit 38ffe26
Showing 1 changed file with 33 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* only if the new code is made subject to such option by the copyright
* holder.
*/
// Portions Copyright [2020-2021] Payara Foundation and/or affiliates
// Portions Copyright 2020-2024 Payara Foundation and/or affiliates

package com.sun.enterprise.v3.server;

Expand Down Expand Up @@ -156,47 +156,47 @@ 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 = habitat.getService(ArchiveType.class, context.getArchiveHandler().getArchiveType());

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

List<T> result = new ArrayList<T>();
for (T sniffer : sniffers) {
if (archiveType != null &&
!sniffer.supportsArchiveType(archiveType)) {
if (archiveType != null && !sniffer.supportsArchiveType(archiveType)) {
continue;
}
String[] annotationNames = sniffer.getAnnotationNames(context);
if (annotationNames==null) continue;
for (String annotationName : annotationNames) {
if (types != null) {
Type type = types.getBy(annotationName);
if (type instanceof AnnotationType) {
Collection<AnnotatedElement> elements = ((AnnotationType) type).allAnnotatedTypes();
for (AnnotatedElement element : elements) {
if (checkPath) {
Type t;
if (element instanceof Member) {
t = ((Member) element).getDeclaringType();
} else if (element instanceof Type) {
t = (Type) element;
} else if (element instanceof ParameterizedType) {
t = ((ParameterizedType) element).getType();
} else {
LOGGER.log(Level.WARNING, "Unrecognised type: {0}.", element);
continue;
}
if (t.wasDefinedIn(uris)) {
result.add(sniffer);
break;
if (annotationNames == null || types == null) {
continue;
}
for (String annotationName : annotationNames) {
types.getAllTypes().stream()
.filter(type -> type instanceof AnnotationType && type.getName().equals(annotationName))
.findFirst().ifPresent(type -> {
Collection<AnnotatedElement> elements = ((AnnotationType) type).allAnnotatedTypes();
for (AnnotatedElement element : elements) {
if (checkPath) {
Type t;
if (element instanceof Member) {
t = ((Member) element).getDeclaringType();
} else if (element instanceof Type) {
t = (Type) element;
} else if (element instanceof ParameterizedType) {
t = ((ParameterizedType) element).getType();
} else {
LOGGER.log(Level.WARNING, "Unrecognised type: {0}.", element);
continue;
}
if (t.wasDefinedIn(uris)) {
result.add(sniffer);
break;
}
} else {
result.add(sniffer);
break;
}
}
} else {
result.add(sniffer);
break;
}
}
}
}
});
}
}
return result;
Expand Down

0 comments on commit 38ffe26

Please sign in to comment.