Schedule REST endpoints return 500 on invalid program type

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 program.programType, for example "WORKER" or "asdf" instead of "WORKFLOW", it will return a 500 error but I am expecting 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.NullPointerException: null at co.cask.cdap.proto.ProgramType.valueOfSchedulableType(ProgramType.java:138) ~[classes/:na] at co.cask.cdap.internal.app.services.ProgramLifecycleService.addSchedule(ProgramLifecycleService.java:831) ~[classes/:na] at co.cask.cdap.gateway.handlers.ProgramLifecycleHttpHandler.doAddSchedule(ProgramLifecycleHttpHandler.java:590) ~[classes/:na] at co.cask.cdap.gateway.handlers.ProgramLifecycleHttpHandler.addSchedule(ProgramLifecycleHttpHandler.java:563) ~[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:

Rohit Sinha April 5, 2017 at 2:07 AM

Denton Liu March 10, 2017 at 12:03 PM

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

Details

Assignee

Reporter

Affects versions

Priority

Created March 10, 2017 at 12:03 PM
Updated April 7, 2017 at 11:42 PM
Resolved April 7, 2017 at 11:42 PM