Skip to content

Commit

Permalink
Undertow: ignore missing servlet class in web.xml
Browse files Browse the repository at this point in the history
Avoids writing a null bean name to the bean archive, which causes a
later build failure.

Fixes #43825
  • Loading branch information
rodcheater committed Oct 24, 2024
1 parent e81fa0c commit df4696b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -430,10 +430,14 @@ public ServletDeploymentManagerBuildItem build(List<ServletBuildItem> servlets,
//add servlets
if (webMetaData.getServlets() != null) {
for (ServletMetaData servlet : webMetaData.getServlets()) {
String servletClass = servlet.getServletClass();
if (servletClass == null) {
continue;
}
reflectiveClasses.accept(
ReflectiveClassBuildItem.builder(servlet.getServletClass()).build());
ReflectiveClassBuildItem.builder(servletClass).build());
RuntimeValue<ServletInfo> sref = recorder.registerServlet(deployment, servlet.getServletName(),
context.classProxy(servlet.getServletClass()),
context.classProxy(servletClass),
servlet.isAsyncSupported(),
servlet.getLoadOnStartupInt(),
bc.getValue(),
Expand All @@ -447,7 +451,7 @@ public ServletDeploymentManagerBuildItem build(List<ServletBuildItem> servlets,
if (webMetaData.getAnnotations() != null) {
for (AnnotationMetaData amd : webMetaData.getAnnotations()) {
final ServletSecurityMetaData ssmd = amd.getServletSecurity();
if (ssmd != null && amd.getClassName().equals(servlet.getServletClass())) {
if (ssmd != null && amd.getClassName().equals(servletClass)) {
// Process the @ServletSecurity into metadata
ServletSecurityInfo securityInfo = new ServletSecurityInfo();
securityInfo.setEmptyRoleSemantic(
Expand All @@ -471,7 +475,7 @@ public ServletDeploymentManagerBuildItem build(List<ServletBuildItem> servlets,
}

final MultipartConfigMetaData mcmd = amd.getMultipartConfig();
if (mcmd != null && amd.getClassName().equals(servlet.getServletClass())) {
if (mcmd != null && amd.getClassName().equals(servletClass)) {
servlet.setMultipartConfig(mcmd);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ WebMetadataBuildItem createWebMetadata(ApplicationArchivesBuildItem applicationA
}
if (metadata.getServlets() != null) {
for (ServletMetaData i : metadata.getServlets()) {
additionalBeans.add(i.getServletClass());
String servletClass = i.getServletClass();
if (servletClass != null) {
additionalBeans.add(servletClass);
}
}
}
if (metadata.getFilters() != null) {
Expand Down

0 comments on commit df4696b

Please sign in to comment.