Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

WFLY-1323 Treat extension add ModuleNotFoundException differently from o... #4478

Closed
wants to merge 1 commit into from

3 participants

@bstansberry
Owner

...ther types of ModuleLoadException

@wildfly-ci
Collaborator

Triggering build using a merge of 46e0f87 on branch master:
Private: http://lightning.mw.lab.eng.bos.redhat.com/jenkins/job/wildfly-param-pull/

@wildfly-ci
Collaborator

Build 7012 is now running using a merge of 46e0f87 on branch master:
Private: http://lightning.mw.lab.eng.bos.redhat.com/jenkins/job/wildfly-param-pull/7012

@jaikiran

Merged

@jaikiran jaikiran closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 8, 2013
  1. @bstansberry

    WFLY-1323 Treat extension add ModuleNotFoundException differently fro…

    bstansberry authored
    …m other types of ModuleLoadException
This page is out of date. Refresh to see the latest.
View
8 controller/src/main/java/org/jboss/as/controller/ControllerMessages.java
@@ -49,6 +49,8 @@
import org.jboss.logging.annotations.MessageBundle;
import org.jboss.logging.annotations.Param;
import org.jboss.modules.ModuleIdentifier;
+import org.jboss.modules.ModuleLoadException;
+import org.jboss.modules.ModuleNotFoundException;
import org.jboss.msc.service.ServiceName;
import org.jboss.msc.service.StartException;
@@ -2648,4 +2650,10 @@
@Message(id = 13452, value = "Legacy extension '%s' is not supported on servers running this version. The extension " +
"is only supported for use by hosts running a previous release in a mixed-version managed domain")
String unsupportedLegacyExtension(String extensionName);
+
+ @Message(id = 13453, value = "Extension module %s not found")
+ OperationFailedException extensionModuleNotFound(@Cause ModuleNotFoundException cause, String module);
+
+ @Message(id = 13454, value = "Failed to load Extension module %s")
+ RuntimeException extensionModuleLoadingFailure(@Cause ModuleLoadException cause, String module);
}
View
12 controller/src/main/java/org/jboss/as/controller/extension/ExtensionAddHandler.java
@@ -21,6 +21,7 @@
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.ADD;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP_ADDR;
+import org.jboss.as.controller.ControllerMessages;
import org.jboss.as.controller.Extension;
import org.jboss.as.controller.OperationContext;
import org.jboss.as.controller.OperationFailedException;
@@ -30,6 +31,7 @@
import org.jboss.modules.Module;
import org.jboss.modules.ModuleIdentifier;
import org.jboss.modules.ModuleLoadException;
+import org.jboss.modules.ModuleNotFoundException;
/**
* Base handler for the extension resource add operation.
@@ -49,7 +51,7 @@
* Create the AbstractAddExtensionHandler
* @param extensionRegistry registry for extensions
* @param parallelBoot {@code true} is parallel initialization of extensions is in progress; {@code false} if not
- * @param slaveHC
+ * @param slaveHC {@code true} if this handler will execute in a slave HostController
*/
public ExtensionAddHandler(final ExtensionRegistry extensionRegistry, final boolean parallelBoot, boolean standalone, boolean slaveHC) {
assert extensionRegistry != null : "extensionRegistry is null";
@@ -97,8 +99,14 @@ void initializeExtension(String module) throws OperationFailedException {
SecurityActions.setThreadContextClassLoader(oldTccl);
}
}
+ } catch (ModuleNotFoundException e) {
+ // Treat this as a user mistake, e.g. incorrect module name.
+ // Throw OFE so post-boot it only gets logged at DEBUG.
+ throw ControllerMessages.MESSAGES.extensionModuleNotFound(e, module);
} catch (ModuleLoadException e) {
- throw new OperationFailedException(new ModelNode().set(e.toString()));
+ // The module is there but can't be loaded. Treat this as an internal problem.
+ // Throw a runtime exception so it always gets logged at ERROR in the server log with stack trace details.
+ throw ControllerMessages.MESSAGES.extensionModuleLoadingFailure(e, module);
}
}
Something went wrong with that request. Please try again.