Uploaded image for project: 'WildFly Core'
  1. WildFly Core
  2. WFCORE-591

revertReloadRequired() throws a NPE is reloadRequired has not been called

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 1.0.0.Beta1
    • 1.0.0.Alpha19
    • Management
    • None

      If an operation step handler calls org.jboss.as.controller.OperationContext#revertReloadRequired() when org.jboss.as.controller.OperationContext#reloadRequired() has not been called, it throws a NPE:

      java.lang.NullPointerException
      	at org.jboss.as.controller.ControlledProcessState.revertReloadRequired(ControlledProcessState.java:181)
      	at org.jboss.as.controller.AbstractOperationContext.revertReloadRequired(AbstractOperationContext.java:1037)
      	at org.jboss.as.controller.test.RevertReloadRequiredTestCase$TestResourceAddHandler.rollbackRuntime(RevertReloadRequiredTestCase.java:98)
      	at org.jboss.as.controller.AbstractAddStepHandler$1$1.handleRollback(AbstractAddStepHandler.java:133)
      	at org.jboss.as.controller.AbstractOperationContext$RollbackDelegatingResultHandler.handleResult(AbstractOperationContext.java:1419)
      	at org.jboss.as.controller.AbstractOperationContext$Step.invokeResultHandler(AbstractOperationContext.java:1385)
      	at org.jboss.as.controller.AbstractOperationContext$Step.handleResult(AbstractOperationContext.java:1367)
      	at org.jboss.as.controller.AbstractOperationContext$Step.finalizeInternal(AbstractOperationContext.java:1323)
      	at org.jboss.as.controller.AbstractOperationContext$Step.finalizeStep(AbstractOperationContext.java:1283)
      	at org.jboss.as.controller.AbstractOperationContext$Step.access$300(AbstractOperationContext.java:1172)
      	at org.jboss.as.controller.AbstractOperationContext.finishStep(AbstractOperationContext.java:929)
      	at org.jboss.as.controller.AbstractOperationContext.executeStep(AbstractOperationContext.java:877)
      	at org.jboss.as.controller.AbstractOperationContext.doCompleteStep(AbstractOperationContext.java:601)
      	at org.jboss.as.controller.AbstractOperationContext.completeStepInternal(AbstractOperationContext.java:354)
      	at org.jboss.as.controller.AbstractOperationContext.executeOperation(AbstractOperationContext.java:330)
      	at org.jboss.as.controller.OperationContextImpl.executeOperation(OperationContextImpl.java:1182)
      	at org.jboss.as.controller.ModelControllerImpl.internalExecute(ModelControllerImpl.java:362)
      	at org.jboss.as.controller.ModelControllerImpl.execute(ModelControllerImpl.java:205)
      

      The NPE is caused by this.activeStep.restartStamp field which is set only when reloadRequired() (or restartRequired()) is called.

      My OSH may call reloadRequired() or not depending on some runtime state and I could add some logic to make sure I call
      I can fix my handle to check that I call context.revertReloadRequired() only I had previously called reloadRequired () first.
      However, in order to make the OperationContext more robust, I think that the revertReloadRequired() method should instead be a no-op if there is no reload required.

              jmesnil1@redhat.com Jeff Mesnil
              jmesnil1@redhat.com Jeff Mesnil
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: