Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FISH-8736 Fix for Web Services Engine Inconsistently Starting #6786

Merged
merged 4 commits into from
Jul 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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