title: Workaround for CronSequenceGenerator Last day of month?
body: <p>Ok so here it is I  want to schedule a task to run on last day of every month on 10:10 AM.My cron expression is</p>
  
  <pre><code>0 10 10 L * ?
  </code></pre>
  
  <p>Now the problem is <a href="http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/scheduling/support/CronSequenceGenerator.html" rel="noreferrer">CronSequenceGenerator</a> is throwing NumberFormatException for 'L' value.This means Spring's CronSequenceGenerator does'nt support this kind of expression.How to do this in any other way (workaround).I don't want to use quartz or Does spring's gonna support this in new releases.</p>
  
  <p>Here is full stacktrace:</p>
  
  <pre><code>Exception in thread "main" java.lang.NumberFormatException: For input string: "L"
      at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
      at java.lang.Integer.parseInt(Integer.java:492)
      at java.lang.Integer.valueOf(Integer.java:582)
      at org.springframework.scheduling.support.CronSequenceGenerator.getRange(CronSequenceGenerator.java:324)
      at org.springframework.scheduling.support.CronSequenceGenerator.setNumberHits(CronSequenceGenerator.java:297)
      at org.springframework.scheduling.support.CronSequenceGenerator.setDays(CronSequenceGenerator.java:275)
      at org.springframework.scheduling.support.CronSequenceGenerator.setDaysOfMonth(CronSequenceGenerator.java:266)
      at org.springframework.scheduling.support.CronSequenceGenerator.parse(CronSequenceGenerator.java:239)
      at org.springframework.scheduling.support.CronSequenceGenerator.&lt;init&gt;(CronSequenceGenerator.java:81)
      at org.springframework.scheduling.support.CronTrigger.&lt;init&gt;(CronTrigger.java:54)
      at org.springframework.scheduling.support.CronTrigger.&lt;init&gt;(CronTrigger.java:44)
      at com.hcdc.coedp.datantar.scheduler.SchedulerUtil.start(SchedulerUtil.java:75)
      at com.hcdc.coedp.datantar.scheduler.SchedulerUtil.changeTrigger(SchedulerUtil.java:106)
      at com.hcdc.coedp.datantar.scheduler.SchedulingService.scheduleTransfer(SchedulingService.java:70)
      at com.hcdc.coedp.datantar.scheduler.Scheduler.schedule(Scheduler.java:107)
      at main.Main.main(Main.java:47)
  </code></pre>
  
  <p>Update:</p>
  
  <p>Following is my scheduling method</p>
  
  <pre><code> /**
      * Schedule a task {@link Task} with a specified cron expression.
      * @param task {@link Task}
      * @param cronExpression cron expression to be applied must be a vaild one.
      * @param taskName
      * @return 
      */
       public String start(Task task, String cronExpression, String taskName) {
          CronTrigger trigger = new CronTrigger(cronExpression);//line 2
  
          CronSequenceGenerator generator = new CronSequenceGenerator(cronExpression, TimeZone.getTimeZone("GMT+5:30"));
          List&lt;Date&gt; dateList = new ArrayList&lt;&gt;(5);
          Date currentDate = new Date();
          for (int i = 0; i &lt; 5; i++) {
              currentDate = generator.next(currentDate);
              dateList.add((currentDate));
              System.out.println("Next Exceution times are" + currentDate);
          }
          ScheduledFuture sf = tps.schedule(task, trigger);
  
          //TODO Save this scheduled future with a specific task name.
          ContextHolder.schduledFutureMap.put(taskName, sf);
          return cronExpression;
      }
  </code></pre>
  
  <p>And on line 2 it throws NumberFormatException when I pass specified cron expression.</p>