Bug 831096 - Wrong parameter in REST xml request causes to NullPointerException
Wrong parameter in REST xml request causes to NullPointerException
Status: CLOSED CURRENTRELEASE
Product: Red Hat Gluster Storage
Classification: Red Hat
Component: rhsc (Show other bugs)
unspecified
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Kanagaraj
Ilia Meerovich
:
Depends On:
Blocks: 825285
  Show dependency treegraph
 
Reported: 2012-06-12 03:45 EDT by Ilia Meerovich
Modified: 2016-07-04 20:06 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-08-10 03:43:25 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Ilia Meerovich 2012-06-12 03:45:51 EDT
Description of problem:

NullPointerException occurs during addition of volume via REST API

Version-Release number of selected component (if applicable):

10 June drop

How reproducible:

easy and deterministic


Steps to Reproduce:
1.Send CREATE request with wrong parameter:

volume_type is Distribute instead of DISTRIBUTE

>>>> CREATE request content is --
>>>>  url:/api/clusters/19ce80b8-b3c5-11e1-8c68-871acd5da6f2/glustervolumes
>>>> body:<gluster_volume>
>>>>      <name>foo</name>
>>>>      <volume_type>Distribute</volume_type>
>>>>      <transport_types>
>>>>          <transport_type>TCP</transport_type>
>>>>      </transport_types>
>>>>      <bricks>
>>>>          <brick>
>>>>              <server_id>1b1cc75e-b3c5-11e1-8e8c-df51891a0c0b</server_id>
>>>>              <brick_dir>/foo</brick_dir>
>>>>          </brick>
>>>>      </bricks>
>>>>      <access_protocols>
>>>>          <access_protocol>NFS</access_protocol>
>>>>      </access_protocols>
>>>> </gluster_volume>
>>>> 

2.
3.
  
Actual results:
>>>> Jboss log:
>>>>
>>>>
>>>> 15:58:52,697 ERROR [stderr] (ajp--0.0.0.0-8009-7)
>>>> java.lang.reflect.InvocationTargetException
>>>> 15:58:52,697 ERROR [stderr] (ajp--0.0.0.0-8009-7)    at
>>>> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>> 15:58:52,698 ERROR [stderr] (ajp--0.0.0.0-8009-7)    at
>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>>>> 15:58:52,698 ERROR [stderr] (ajp--0.0.0.0-8009-7)    at
>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>>> 15:58:52,699 ERROR [stderr] (ajp--0.0.0.0-8009-7)    at
>>>> java.lang.reflect.Method.invoke(Method.java:616)
>>>> 15:58:52,699 ERROR [stderr] (ajp--0.0.0.0-8009-7)    at
>>>> org.ovirt.engine.api.restapi.types.MappingLocator$MethodInvokerMapper.map(MappingLocator.java:253)
>>>> 15:58:52,700 ERROR [stderr] (ajp--0.0.0.0-8009-7)    at
>>>> org.ovirt.engine.api.restapi.resource.gluster.BackendGlusterVolumesResource.add(BackendGlusterVolumesResource.java:79)
>>>> 15:58:52,700 ERROR [stderr] (ajp--0.0.0.0-8009-7)    at
>>>> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>> 15:58:52,700 ERROR [stderr] (ajp--0.0.0.0-8009-7)    at
>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>>>> 15:58:52,701 ERROR [stderr] (ajp--0.0.0.0-8009-7)    at
>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>>> 15:58:52,706 ERROR [stderr] (ajp--0.0.0.0-8009-7)    at
>>>> java.lang.reflect.Method.invoke(Method.java:616)
>>>> 15:58:52,706 ERROR [stderr] (ajp--0.0.0.0-8009-7)    at
>>>> org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:155)
>>>> 15:58:52,706 ERROR [stderr] (ajp--0.0.0.0-8009-7)    at
>>>> org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:257)
>>>> 15:58:52,707 ERROR [stderr] (ajp--0.0.0.0-8009-7)    at
>>>> org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:222)
>>>> 15:58:52,707 ERROR [stderr] (ajp--0.0.0.0-8009-7)    at
>>>> org.jboss.resteasy.core.ResourceLocator.invokeOnTargetObject(ResourceLocator.java:152)
>>>> 15:58:52,707 ERROR [stderr] (ajp--0.0.0.0-8009-7)    at
>>>> org.jboss.resteasy.core.ResourceLocator.invoke(ResourceLocator.java:106)
>>>> 15:58:52,708 ERROR [stderr] (ajp--0.0.0.0-8009-7)    at
>>>> org.jboss.resteasy.core.ResourceLocator.invokeOnTargetObject(ResourceLocator.java:147)
>>>> 15:58:52,708 ERROR [stderr] (ajp--0.0.0.0-8009-7)    at
>>>> org.jboss.resteasy.core.ResourceLocator.invoke(ResourceLocator.java:91)
>>>> 15:58:52,708 ERROR [stderr] (ajp--0.0.0.0-8009-7)    at
>>>> org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:525)
>>>> 15:58:52,709 ERROR [stderr] (ajp--0.0.0.0-8009-7)    at
>>>> org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:502)
>>>> 15:58:52,709 ERROR [stderr] (ajp--0.0.0.0-8009-7)    at
>>>> org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:119)
>>>> 15:58:52,710 ERROR [stderr] (ajp--0.0.0.0-8009-7)    at
>>>> org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)
>>>> 15:58:52,710 ERROR [stderr] (ajp--0.0.0.0-8009-7)    at
>>>> org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)
>>>> 15:58:52,711 ERROR [stderr] (ajp--0.0.0.0-8009-7)    at
>>>> org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)
>>>> 15:58:52,711 ERROR [stderr] (ajp--0.0.0.0-8009-7)    at
>>>> javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
>>>> 15:58:52,711 ERROR [stderr] (ajp--0.0.0.0-8009-7)    at
>>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
>>>> 15:58:52,712 ERROR [stderr] (ajp--0.0.0.0-8009-7)    at
>>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
>>>> 15:58:52,712 ERROR [stderr] (ajp--0.0.0.0-8009-7)    at
>>>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
>>>> 15:58:52,713 ERROR [stderr] (ajp--0.0.0.0-8009-7)    at
>>>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
>>>> 15:58:52,713 ERROR [stderr] (ajp--0.0.0.0-8009-7)    at
>>>> org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)
>>>> 15:58:52,713 ERROR [stderr] (ajp--0.0.0.0-8009-7)    at
>>>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
>>>> 15:58:52,714 ERROR [stderr] (ajp--0.0.0.0-8009-7)    at
>>>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>>>> 15:58:52,714 ERROR [stderr] (ajp--0.0.0.0-8009-7)    at
>>>> org.jboss.web.rewrite.RewriteValve.invoke(RewriteValve.java:466)
>>>> 15:58:52,715 ERROR [stderr] (ajp--0.0.0.0-8009-7)    at
>>>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>>>> 15:58:52,715 ERROR [stderr] (ajp--0.0.0.0-8009-7)    at
>>>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)
>>>> 15:58:52,715 ERROR [stderr] (ajp--0.0.0.0-8009-7)    at
>>>> org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:505)
>>>> 15:58:52,716 ERROR [stderr] (ajp--0.0.0.0-8009-7)    at
>>>> org.apache.coyote.ajp.AjpProtocol$AjpConnectionHandler.process(AjpProtocol.java:445)
>>>> 15:58:52,716 ERROR [stderr] (ajp--0.0.0.0-8009-7)    at
>>>> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)
>>>> 15:58:52,716 ERROR [stderr] (ajp--0.0.0.0-8009-7)    at
>>>> java.lang.Thread.run(Thread.java:679)
>>>> 15:58:52,717 ERROR [stderr] (ajp--0.0.0.0-8009-7) Caused by:
>>>> java.lang.IllegalArgumentException: No enum const class
>>>> org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeType.Distribute
>>>> 15:58:52,717 ERROR [stderr] (ajp--0.0.0.0-8009-7)    at
>>>> java.lang.Enum.valueOf(Enum.java:214)
>>>> 15:58:52,718 ERROR [stderr] (ajp--0.0.0.0-8009-7)    at
>>>> org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeType.valueOf(GlusterVolumeType.java:7)
>>>> 15:58:52,718 ERROR [stderr] (ajp--0.0.0.0-8009-7)    at
>>>> org.ovirt.engine.api.restapi.types.GlusterVolumeMapper.map(GlusterVolumeMapper.java:36)
>>>> 15:58:52,718 ERROR [stderr] (ajp--0.0.0.0-8009-7)    ... 38 more
>>>> 15:58:52,728 ERROR
>>>> [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/api].[Resteasy]]
>>>> (ajp--0.0.0.0-8009-7) Servlet.service() for servlet Resteasy threw
>>>> exception: org.jboss.resteasy.spi.UnhandledException:
>>>> java.lang.NullPointerException
>>>>    at
>>>>    org.jboss.resteasy.core.SynchronousDispatcher.handleApplicationException(SynchronousDispatcher.java:340)
>>>>    [resteasy-jaxrs.jar:2.3.2.Final-redhat-1]
>>>>    at
>>>>    org.jboss.resteasy.core.SynchronousDispatcher.handleException(SynchronousDispatcher.java:214)
>>>>    [resteasy-jaxrs.jar:2.3.2.Final-redhat-1]
>>>>    at
>>>>    org.jboss.resteasy.core.SynchronousDispatcher.handleInvokerException(SynchronousDispatcher.java:190)
>>>>    [resteasy-jaxrs.jar:2.3.2.Final-redhat-1]
>>>>    at
>>>>    org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:540)
>>>>    [resteasy-jaxrs.jar:2.3.2.Final-redhat-1]
>>>>    at
>>>>    org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:502)
>>>>    [resteasy-jaxrs.jar:2.3.2.Final-redhat-1]
>>>>    at
>>>>    org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:119)
>>>>    [resteasy-jaxrs.jar:2.3.2.Final-redhat-1]
>>>>    at
>>>>    org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)
>>>>    [resteasy-jaxrs.jar:2.3.2.Final-redhat-1]
>>>>    at
>>>>    org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)
>>>>    [resteasy-jaxrs.jar:2.3.2.Final-redhat-1]
>>>>    at
>>>>    org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)
>>>>    [resteasy-jaxrs.jar:2.3.2.Final-redhat-1]
>>>>    at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
>>>>    [jboss-servlet-api_3.0_spec.jar:1.0.0.Final-redhat-1]
>>>>    at
>>>>    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
>>>>    [jbossweb.jar:]
>>>>    at
>>>>    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
>>>>    [jbossweb.jar:]
>>>>    at
>>>>    org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
>>>>    [jbossweb.jar:]
>>>>    at
>>>>    org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
>>>>    [jbossweb.jar:]
>>>>    at
>>>>    org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)
>>>>    [jboss-as-web.jar:7.1.1.Final-redhat-1]
>>>>    at
>>>>    org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
>>>>    [jbossweb.jar:]
>>>>    at
>>>>    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>>>>    [jbossweb.jar:]
>>>>    at
>>>>    org.jboss.web.rewrite.RewriteValve.invoke(RewriteValve.java:466)
>>>>    [jbossweb.jar:]
>>>>    at
>>>>    org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>>>>    [jbossweb.jar:]
>>>>    at
>>>>    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)
>>>>    [jbossweb.jar:]
>>>>    at
>>>>    org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:505)
>>>>    [jbossweb.jar:]
>>>>    at
>>>>    org.apache.coyote.ajp.AjpProtocol$AjpConnectionHandler.process(AjpProtocol.java:445)
>>>>    [jbossweb.jar:]
>>>>    at
>>>>    org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)
>>>>    [jbossweb.jar:]
>>>>    at java.lang.Thread.run(Thread.java:679) [rt.jar:1.6.0_24]
>>>> Caused by: java.lang.NullPointerException
>>>>    at
>>>>    org.ovirt.engine.api.restapi.resource.gluster.BackendGlusterVolumesResource.add(BackendGlusterVolumesResource.java:80)
>>>>    [restapi-jaxrs-2.0.techpreview1.jar:]
>>>>    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>    [rt.jar:1.6.0_24]
>>>>    at
>>>>    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>>>>    [rt.jar:1.6.0_24]
>>>>    at
>>>>    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>>>    [rt.jar:1.6.0_24]
>>>>    at java.lang.reflect.Method.invoke(Method.java:616)
>>>>    [rt.jar:1.6.0_24]
>>>>    at
>>>>    org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:155)
>>>>    [resteasy-jaxrs.jar:2.3.2.Final-redhat-1]
>>>>    at
>>>>    org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:257)
>>>>    [resteasy-jaxrs.jar:2.3.2.Final-redhat-1]
>>>>    at
>>>>    org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:222)
>>>>    [resteasy-jaxrs.jar:2.3.2.Final-redhat-1]
>>>>    at
>>>>    org.jboss.resteasy.core.ResourceLocator.invokeOnTargetObject(ResourceLocator.java:152)
>>>>    [resteasy-jaxrs.jar:2.3.2.Final-redhat-1]
>>>>    at
>>>>    org.jboss.resteasy.core.ResourceLocator.invoke(ResourceLocator.java:106)
>>>>    [resteasy-jaxrs.jar:2.3.2.Final-redhat-1]
>>>>    at
>>>>    org.jboss.resteasy.core.ResourceLocator.invokeOnTargetObject(ResourceLocator.java:147)
>>>>    [resteasy-jaxrs.jar:2.3.2.Final-redhat-1]
>>>>    at
>>>>    org.jboss.resteasy.core.ResourceLocator.invoke(ResourceLocator.java:91)
>>>>    [resteasy-jaxrs.jar:2.3.2.Final-redhat-1]
>>>>    at
>>>>    org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:525)
>>>>    [resteasy-jaxrs.jar:2.3.2.Final-redhat-1]

Expected results:

Request should return error with error description

Additional info:
Comment 2 Kanagaraj 2012-06-12 08:02:07 EDT
Enum Validations are added to Volume Type, Transport Type and Access Protocols.
Before doing the validation, the values will be converted to UpperCase.

Following is the sample response when passing X as Volume Type:

<fault>
<reason>Invalid value</reason>
<detail>X is not a member of GlusterVolumeType</detail>
</fault>

Patch: http://gerrit.ovirt.org/#/c/5278/
Comment 3 Ilia Meerovich 2012-06-17 07:27:42 EDT
verifed with 15 June build

Note You need to log in before you can comment on or make changes to this bug.