eclipse-archived / smarthome

Eclipse SmartHome™ project
https://www.eclipse.org/smarthome/
Eclipse Public License 2.0
865 stars 782 forks source link

500 Request failed while updating a rule #708

Closed aounhaider1 closed 8 years ago

aounhaider1 commented 8 years ago

Server responds with a 500 Request failed error when we try to update a rule by adding a new trigger of type 'GenericEventTrigger' or 'TimerTrigger' (trigger configuration not specified). The new triggers is however added to the server.

kaikreuzer commented 8 years ago

@aounhaider1 Could you please add the exception from your log?

aounhaider1 commented 8 years ago
2015-12-10 11:38:36 [WARN ] [e.jetty.servlet.ServletHandler:620  ] - javax.servlet.ServletException: java.lang.IllegalArgumentException: cronExpression cannot be null
    at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:423)
    at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:386)
    at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:334)
    at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:221)
    at com.eclipsesource.jaxrs.publisher.internal.ServletContainerBridge.service(ServletContainerBridge.java:76)
    at org.eclipse.equinox.http.servlet.internal.ServletRegistration.service(ServletRegistration.java:61)
    at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:128)
    at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:68)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:808)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:587)
Caused by: java.lang.IllegalArgumentException: cronExpression cannot be null
    at org.quartz.CronExpression.<init>(CronExpression.java:271)
    at org.quartz.CronScheduleBuilder.cronSchedule(CronScheduleBuilder.java:107)
    at org.eclipse.smarthome.automation.module.timer.handler.TimerTriggerHandler.<init>(TimerTriggerHandler.java:54)
    at org.eclipse.smarthome.automation.module.timer.factory.TimerModuleHandlerFactory.internalCreate(TimerModuleHandlerFactory.java:54)
    at org.eclipse.smarthome.automation.handler.BaseModuleHandlerFactory.getHandler(BaseModuleHandlerFactory.java:37)
    at org.eclipse.smarthome.automation.core.internal.RuleEngine.getModuleHandler(RuleEngine.java:597)
    at org.eclipse.smarthome.automation.core.internal.RuleEngine.setModuleHandler(RuleEngine.java:478)
    at org.eclipse.smarthome.automation.core.internal.RuleEngine.setRule(RuleEngine.java:387)
    at org.eclipse.smarthome.automation.core.internal.RuleEngine.updateRule(RuleEngine.java:330)
    at org.eclipse.smarthome.automation.core.internal.RuleRegistryImpl.update(RuleRegistryImpl.java:135)
    at org.eclipse.smarthome.automation.core.internal.RuleRegistryImpl.update(RuleRegistryImpl.java:1)

2015-12-10 11:38:36 [WARN ] [lipse.jetty.server.HttpChannel:395  ] - /rest/rules/rule_41javax.servlet.ServletException: javax.servlet.ServletException: java.lang.IllegalArgumentException: cronExpression cannot be null
    at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:130)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
    at org.eclipse.jetty.server.Server.handle(Server.java:499)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
    at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
    at java.lang.Thread.run(Thread.java:745)
Caused by: javax.servlet.ServletException: java.lang.IllegalArgumentException: cronExpression cannot be null
    at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:423)
    at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:386)
    at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:334)
    at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:221)
    at com.eclipsesource.jaxrs.publisher.internal.ServletContainerBridge.service(ServletContainerBridge.java:76)
    at org.eclipse.equinox.http.servlet.internal.ServletRegistration.service(ServletRegistration.java:61)
    at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:128)
    at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:68)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:808)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:587)
Caused by: java.lang.IllegalArgumentException: cronExpression cannot be null
    at org.quartz.CronExpression.<init>(CronExpression.java:271)
    at org.quartz.CronScheduleBuilder.cronSchedule(CronScheduleBuilder.java:107)
    at org.eclipse.smarthome.automation.module.timer.handler.TimerTriggerHandler.<init>(TimerTriggerHandler.java:54)
    at org.eclipse.smarthome.automation.module.timer.factory.TimerModuleHandlerFactory.internalCreate(TimerModuleHandlerFactory.java:54)
    at org.eclipse.smarthome.automation.handler.BaseModuleHandlerFactory.getHandler(BaseModuleHandlerFactory.java:37)
    at org.eclipse.smarthome.automation.core.internal.RuleEngine.getModuleHandler(RuleEngine.java:597)
    at org.eclipse.smarthome.automation.core.internal.RuleEngine.setModuleHandler(RuleEngine.java:478)
    at org.eclipse.smarthome.automation.core.internal.RuleEngine.setRule(RuleEngine.java:387)
    at org.eclipse.smarthome.automation.core.internal.RuleEngine.updateRule(RuleEngine.java:330)
    at org.eclipse.smarthome.automation.core.internal.RuleRegistryImpl.update(RuleRegistryImpl.java:135)
    at org.eclipse.smarthome.automation.core.internal.RuleRegistryImpl.update(RuleRegistryImpl.java:1)

2015-12-10 11:38:36 [WARN ] [lipse.jetty.server.HttpChannel:481  ] - Could not send response error 500: javax.servlet.ServletException: javax.servlet.ServletException: java.lang.IllegalArgumentException: cronExpression cannot be null
danchom commented 8 years ago

The problem is that the default values from ModuleTypes definition are not get in mind when the configuration is missing or a property with default value is not appear in configuration. Same as #706

kaikreuzer commented 8 years ago

It is clear that the request is invalid in this case, but the issue is that HTTP 500 is not a valid response to this either.

kaikreuzer commented 8 years ago

Fixed by https://github.com/eclipse/smarthome/pull/725