Bug 1092448
| Summary: | Restapi throws NPE when when adding step to job with incorrect step type. | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Virtualization Manager | Reporter: | Ondra Machacek <omachace> |
| Component: | ovirt-engine-restapi | Assignee: | Ori Liel <oliel> |
| Status: | CLOSED CURRENTRELEASE | QA Contact: | Ondra Machacek <omachace> |
| Severity: | unspecified | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 3.4.0 | CC: | aberezin, bazulay, emesika, gklein, iheim, juan.hernandez, oliel, oourfali, oramraz, pstehlik, rbalakri, Rhev-m-bugs, yeylon |
| Target Milestone: | --- | ||
| Target Release: | 3.5.0 | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | infra | ||
| Fixed In Version: | ovirt-engine-3.5.0_alpha1 | Doc Type: | Bug Fix |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2015-02-17 17:08:40 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | Infra | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
| Bug Depends On: | |||
| Bug Blocks: | 1142923, 1156165 | ||
This happens because the RESTAPI isn't validating the values of the enumerated type. We need to create a "StepValidator" class, similar to "DiskValidator", for example. Then we need to call the "validateEnums()" method in the appropriate places inside the resource implementation. Eli, can you take care of this? (In reply to Juan Hernández from comment #1) > This happens because the RESTAPI isn't validating the values of the > enumerated type. We need to create a "StepValidator" class, similar to > "DiskValidator", for example. Then we need to call the "validateEnums()" > method in the appropriate places inside the resource implementation. > > Eli, can you take care of this? Sure Patch posted: http://gerrit.ovirt.org/#/c/27232/1 Verified in ovirt-engine-backend-3.5.0-0.0.master.20140605145557.git3ddd2de.el6.noarch. add step --job-identifier 'dce4297b-98ff-4ee7-a434-08a0b4ca33f8' --description 'step_External_tasks_test' --job-id 'dce4297b-98ff-4ee7-a434-08a0b4ca33f8' --type 'NONEXISTING_TYPE' --expect '201-created' ============================================================================================== ERROR ============================================================================================ status: 400 reason: Bad Request detail: NONEXISTING_TYPE is not a member of StepEnum. Possible values for StepEnum are: validating, executing, finalizing, rebalancing_volume, removing_bricks, unknown ================================================================================================================================================================================================= rhev 3.5.0 was released. closing. |
Description of problem: Version-Release number of selected component (if applicable): rhevm-restapi-3.4.0-0.15.beta3.el6ev.noarch How reproducible: always Steps to Reproduce: 1. add step to job with nonexisting type add step --job-identifier '00718cab-eb9f-4166-9377-2c2de4259ca7' --description 'step_External_tasks_test' --job-id '00718cab-eb9f-4166-9377-2c2de4259ca7' --type 'NONEXISTING_TYPE' --expect '201-created' Actual results: NPE Expected results: error message - wrong step type Additional info: Failed to create a new element: 13:32:47 Status: 500 13:32:47 Reason: Internal Server Error 13:32:47 Detail: <html><head><title>JBoss Web/7.3.1.Final-redhat-1 - JBWEB000064: Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>JBWEB000065: HTTP Status 500 - java.lang.NullPointerException</h1><HR size="1" noshade="noshade"><p><b>JBWEB000309: type</b> JBWEB000066: Exception report</p><p><b>JBWEB000068: message</b> <u>java.lang.NullPointerException</u></p><p><b>JBWEB000069: description</b> <u>JBWEB000145: The server encountered an internal error that prevented it from fulfilling this request.</u></p><p><b>JBWEB000070: exception</b> <pre>org.jboss.resteasy.spi.UnhandledException: java.lang.NullPointerException 13:32:47 org.jboss.resteasy.core.SynchronousDispatcher.handleApplicationException(SynchronousDispatcher.java:365) 13:32:47 org.jboss.resteasy.core.SynchronousDispatcher.handleException(SynchronousDispatcher.java:233) 13:32:47 org.jboss.resteasy.core.SynchronousDispatcher.handleInvokerException(SynchronousDispatcher.java:209) 13:32:47 org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:557) 13:32:47 org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524) 13:32:47 org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:126) 13:32:47 org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208) 13:32:47 org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55) 13:32:47 org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50) 13:32:47 javax.servlet.http.HttpServlet.service(HttpServlet.java:847) 13:32:47 org.ovirt.engine.core.authentication.AuthenticationFilter.doFilter(AuthenticationFilter.java:80) 13:32:47 </pre></p><p><b>JBWEB000071: root cause</b> <pre>java.lang.NullPointerException 13:32:47 org.ovirt.engine.api.restapi.types.StepMapper.map(StepMapper.java:82) 13:32:47 org.ovirt.engine.api.restapi.resource.BackendStepsResource.add(BackendStepsResource.java:52) 13:32:47 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 13:32:47 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 13:32:47 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 13:32:47 java.lang.reflect.Method.invoke(Method.java:606) 13:32:47 org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:167) 13:32:47 org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:269) 13:32:47 org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:227) 13:32:47 org.jboss.resteasy.core.ResourceLocator.invokeOnTargetObject(ResourceLocator.java:159) 13:32:47 org.jboss.resteasy.core.ResourceLocator.invoke(ResourceLocator.java:107) 13:32:47 org.jboss.resteasy.core.ResourceLocator.invokeOnTargetObject(ResourceLocator.java:154) 13:32:47 org.jboss.resteasy.core.ResourceLocator.invoke(ResourceLocator.java:92) 13:32:47 org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:542) 13:32:47 org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524) 13:32:47 org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:126) 13:32:47 org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208) 13:32:47 org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55) 13:32:47 org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50) 13:32:47 javax.servlet.http.HttpServlet.service(HttpServlet.java:847) 13:32:47 org.ovirt.engine.core.authentication.AuthenticationFilter.doFilter(AuthenticationFilter.java:80) 13:32:47 </pre></p><p><b>JBWEB000072: note</b> <u>JBWEB000073: The full stack trace of the root cause is available in the JBoss Web/7.3.1.Final-redhat-1 logs.</u></p><HR size="1" noshade="noshade"><h3>JBoss Web/7.3.1.Final-redhat-1</h3></body></html> 13:32:47 Trace: 13:32:47 org.ovirt.engine.sdk.web.HttpProxy.execute(Unknown Source) 13:32:47 org.ovirt.engine.sdk.web.HttpProxyBroker.add(Unknown Source) 13:32:47 org.ovirt.engine.sdk.decorators.JobSteps.add(Unknown Source)