Skip to content

Commit

Permalink
[WFCORE-6843] Logging a WARN if a deployment's runtime name doesn't h…
Browse files Browse the repository at this point in the history
…ave an extension
  • Loading branch information
khermano committed Feb 13, 2025
1 parent dc2fb6a commit 2f2cb16
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.jboss.as.repository.HostFileRepository;
import org.jboss.as.server.deployment.ModelContentReference;
import org.jboss.dmr.ModelNode;
import org.jboss.logging.Logger;

/**
* Handles addition of a deployment to a server group.
Expand All @@ -39,6 +40,7 @@ public class ServerGroupDeploymentAddHandler implements OperationStepHandler {

private final HostFileRepository fileRepository;
private final ContentRepository contentRepository;
private static final Logger logger = Logger.getLogger("org.jboss.as.domain.controller.operations.deployment");

public ServerGroupDeploymentAddHandler(final HostFileRepository fileRepository, ContentRepository contentRepository) {
this.fileRepository = fileRepository;
Expand Down Expand Up @@ -94,6 +96,9 @@ static void validateRuntimeNames(String deploymentName, OperationContext context
Resource root = context.readResourceFromRoot(PathAddress.EMPTY_ADDRESS);
ModelNode domainDeployment = root.getChild(PathElement.pathElement(DEPLOYMENT, deploymentName)).getModel();
String runtimeName = getRuntimeName(deploymentName, deployment, domainDeployment);
if (!runtimeName.contains(".")) {
logger.warnf("Deployment '%s' has a runtime name '%s' without an extension. This may cause issues in some environments.", deploymentName, runtimeName);
}
PathAddress sgAddress = address.subAddress(0, address.size() - 1);
Resource serverGroup = root.navigate(sgAddress);
for (Resource.ResourceEntry re : serverGroup.getChildren(DEPLOYMENT)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import org.jboss.as.server.deploymentoverlay.DeploymentOverlayIndex;
import org.jboss.as.server.logging.ServerLogger;
import org.jboss.dmr.ModelNode;
import org.jboss.logging.Logger;
import org.jboss.msc.service.LifecycleEvent;
import org.jboss.msc.service.LifecycleListener;
import org.jboss.msc.service.ServiceBuilder;
Expand All @@ -69,6 +70,7 @@
public class DeploymentHandlerUtil {

private static final OperationContext.AttachmentKey<AnnotationIndexSupport> ANNOTATION_INDEX_SUPPORT = OperationContext.AttachmentKey.create(AnnotationIndexSupport.class);
private static final Logger logger = Logger.getLogger("org.jboss.as.server.deployment");

static class ContentItem {
// either hash or <path, relativeTo, isArchive>
Expand Down Expand Up @@ -142,6 +144,9 @@ public static void deploy(final OperationContext context, final ModelNode operat

context.addStep(new OperationStepHandler() {
public void execute(OperationContext context, ModelNode operation) {
if (!deploymentUnitName.contains(".")) {
logger.warnf("Deployment '%s' has a runtime name '%s' without an extension. This may cause issues in some environments.", managementName, deploymentUnitName);
}
final ServiceName deploymentUnitServiceName = Services.deploymentUnitName(deploymentUnitName);
final ServiceRegistry serviceRegistry = context.getServiceRegistry(true);
final ServiceController<?> deploymentController = serviceRegistry.getService(deploymentUnitServiceName);
Expand Down

0 comments on commit 2f2cb16

Please sign in to comment.