Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-15713

Remove redundant null checks in TimerHandleImpl constructor

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Done
    • Icon: Minor Minor
    • 26.0.0.Final
    • None
    • EJB

      TimerHandleImpl constructor first checks for null values with the parameters (id, timedObjectId, timerService), and throws IllegalArgumentException if any of them is null.

      This constructor is only called from TimerImpl class, and these params are known to be non-null. So we should be able to remove these null checks, and associated methods in EjbLogger class.

      public TimerHandleImpl(final String id, final String timedObjectId, final TimerServiceImpl service) throws IllegalArgumentException {
              if (id == null) {
                  throw EjbLogger.EJB3_TIMER_LOGGER.idIsNull();
              }
              if (timedObjectId == null) {
                  throw EjbLogger.EJB3_TIMER_LOGGER.timedObjectNull();
              }
              if (service == null) {
                  throw EjbLogger.EJB3_TIMER_LOGGER.timerServiceIsNull();
              }
      
              this.timedObjectId = timedObjectId;
              this.id = id;
              this.service = service;
              this.serviceName = service.getServiceName().getCanonicalName();
          }
      

            rchakrab Ranabir Chakraborty
            cfang@redhat.com Cheng Fang
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: