Schedule REST endpoints return 500 on invalid cron schedule

Description

You can currently create a new schedule using the following endpoint: PUT /v3/namespaces/default/apps/<app-id>/versions/<app-version>/schedules/<schedule-id>.

In the PUT request, you are supposed to include a JSON object with the schedule that you would like to create. If you give an invalid cron schedule, you will get a 500 error, even though it should be a 400 error.

It remains to be tested whether this will affect the endpoint POST /v3/namespaces/default/apps/<app-id>/versions/<app-version>/schedules/<schedule-id>/update as well.

This is the stacktrace I'm getting:

java.lang.IllegalArgumentException: Invalid cron entry format at com.google.common.base.Preconditions.checkArgument(Preconditions.java:92) ~[guava-13.0.1.jar:na] at co.cask.cdap.internal.app.runtime.schedule.TimeScheduler.getQuartzCronExpression(TimeScheduler.java:440) ~[classes/:na] at co.cask.cdap.internal.app.runtime.schedule.TimeScheduler.updateSchedule(TimeScheduler.java:348) ~[classes/:na] at co.cask.cdap.internal.app.runtime.schedule.AbstractSchedulerService.updateSchedule(AbstractSchedulerService.java:183) ~[classes/:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_112] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_112] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_112] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_112] at com.google.inject.internal.DelegatingInvocationHandler.invoke(DelegatingInvocationHandler.java:37) ~[guice-3.0.jar:na] at com.sun.proxy.$Proxy46.updateSchedule(Unknown Source) ~[na:na] at co.cask.cdap.internal.app.services.ProgramLifecycleService.updateSchedule(ProgramLifecycleService.java:893) ~[classes/:na] at co.cask.cdap.gateway.handlers.ProgramLifecycleHttpHandler.doUpdateSchedule(ProgramLifecycleHttpHandler.java:642) ~[classes/:na] at co.cask.cdap.gateway.handlers.ProgramLifecycleHttpHandler.updateSchedule(ProgramLifecycleHttpHandler.java:614) ~[classes/:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_112] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_112] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_112] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_112] at co.cask.http.HttpMethodInfo.invoke(HttpMethodInfo.java:80) ~[netty-http-0.16.0.jar:na] at co.cask.http.HttpDispatcher.messageReceived(HttpDispatcher.java:38) [netty-http-0.16.0.jar:na] at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70) [netty-3.6.6.Final.jar:na] at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564) [netty-3.6.6.Final.jar:na] at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791) [netty-3.6.6.Final.jar:na] at org.jboss.netty.handler.execution.ChannelUpstreamEventRunnable.doRun(ChannelUpstreamEventRunnable.java:43) [netty-3.6.6.Final.jar:na] at org.jboss.netty.handler.execution.ChannelEventRunnable.run(ChannelEventRunnable.java:67) [netty-3.6.6.Final.jar:na] at org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor$ChildExecutor.run(OrderedMemoryAwareThreadPoolExecutor.java:314) [netty-3.6.6.Final.jar:na] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_112] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_112] at java.lang.Thread.run(Thread.java:745) [na:1.8.0_112]

Release Notes

None

Activity

Show:

Denton Liu March 10, 2017 at 11:57 AM

this might be of interest to you.

Duplicate
Pinned fields
Click on the next to a field label to start pinning.

Details

Assignee

Reporter

Affects versions

Priority

Created March 10, 2017 at 11:57 AM
Updated April 5, 2017 at 2:02 AM
Resolved April 5, 2017 at 1:39 AM