+++ This bug was initially created as a clone of Bug #1073359 +++ Description of problem: Version-Release number of selected component (if applicable): av2 How reproducible: always Steps to Reproduce: 1. /api/domains/6272712d-6970-612e-7268-65762e6c6162/users?search=abcdefg=123456 Actual results: <fault><reason>Operation Failed</reason><detail>Cannot cast java.util.Collections$EmptyList to java.util.ArrayList</detail></fault> Expected results: <users/> Additional info: 2014-03-06 10:34:17,768 INFO [org.ovirt.engine.core.bll.LoginUserCommand] (ajp-/127.0.0.1:8702-11) Running command: LoginUserCommand internal: false. 2014-03-06 10:34:17,790 INFO [org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector] (ajp-/127.0.0.1:8702-11) Correlation ID: null, Call Stack: null, Custom Event ID: -1, Message: User admin logged in. 2014-03-06 10:34:17,792 WARN [org.ovirt.engine.core.bll.SearchQuery] (ajp-/127.0.0.1:8702-11) ResourceManager::searchBusinessObjects - erroneous search text - ADUSER: abcdefg=123456 2014-03-06 10:34:17,792 ERROR [org.ovirt.engine.api.restapi.resource.AbstractBackendResource] (ajp-/127.0.0.1:8702-11) Operation Failed: Cannot cast java.util.Collections$EmptyList to java.util.ArrayList: java.lang.ClassCastException: Cannot cast java.util.Collections$EmptyList to java.util.ArrayList at java.lang.Class.cast(Class.java:3005) [rt.jar:1.7.0_09-icedtea] at org.ovirt.engine.api.restapi.resource.BackendResource.getEntity(BackendResource.java:65) [restapi-jaxrs.jar:] at org.ovirt.engine.api.restapi.resource.BackendDomainUsersResource.getDomainUsers(BackendDomainUsersResource.java:80) [restapi-jaxrs.jar:] at org.ovirt.engine.api.restapi.resource.BackendDomainUsersResource.list(BackendDomainUsersResource.java:99) [restapi-jaxrs.jar:] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_09-icedtea] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_09-icedtea] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_09-icedtea] at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_09-icedtea] at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:167) [resteasy-jaxrs.jar:2.3.7.Final-redhat-2] at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:269) [resteasy-jaxrs.jar:2.3.7.Final-redhat-2] at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:227) [resteasy-jaxrs.jar:2.3.7.Final-redhat-2] at org.jboss.resteasy.core.ResourceLocator.invokeOnTargetObject(ResourceLocator.java:159) [resteasy-jaxrs.jar:2.3.7.Final-redhat-2] at org.jboss.resteasy.core.ResourceLocator.invoke(ResourceLocator.java:107) [resteasy-jaxrs.jar:2.3.7.Final-redhat-2] at org.jboss.resteasy.core.ResourceLocator.invokeOnTargetObject(ResourceLocator.java:154) [resteasy-jaxrs.jar:2.3.7.Final-redhat-2] at org.jboss.resteasy.core.ResourceLocator.invoke(ResourceLocator.java:92) [resteasy-jaxrs.jar:2.3.7.Final-redhat-2] at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:542) [resteasy-jaxrs.jar:2.3.7.Final-redhat-2] at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524) [resteasy-jaxrs.jar:2.3.7.Final-redhat-2] at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:126) [resteasy-jaxrs.jar:2.3.7.Final-redhat-2] at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208) [resteasy-jaxrs.jar:2.3.7.Final-redhat-2] at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55) [resteasy-jaxrs.jar:2.3.7.Final-redhat-2] at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50) [resteasy-jaxrs.jar:2.3.7.Final-redhat-2] at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec.jar:1.0.2.Final-redhat-1] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295) [jbossweb.jar:7.2.2.Final-redhat-1] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) [jbossweb.jar:7.2.2.Final-redhat-1] at org.ovirt.engine.core.authentication.AuthenticationFilter.doFilter(AuthenticationFilter.java:80) [common.jar:] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246) [jbossweb.jar:7.2.2.Final-redhat-1] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) [jbossweb.jar:7.2.2.Final-redhat-1] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230) [jbossweb.jar:7.2.2.Final-redhat-1] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149) [jbossweb.jar:7.2.2.Final-redhat-1] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:499) [jbossweb.jar:7.2.2.Final-redhat-1] at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169) [jboss-as-web.jar:7.3.2.Final-redhat-1] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:145) [jbossweb.jar:7.2.2.Final-redhat-1] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97) [jbossweb.jar:7.2.2.Final-redhat-1] at org.jboss.web.rewrite.RewriteValve.invoke(RewriteValve.java:466) [jbossweb.jar:7.2.2.Final-redhat-1] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102) [jbossweb.jar:7.2.2.Final-redhat-1] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:336) [jbossweb.jar:7.2.2.Final-redhat-1] at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:488) [jbossweb.jar:7.2.2.Final-redhat-1] at org.apache.coyote.ajp.AjpProtocol$AjpConnectionHandler.process(AjpProtocol.java:420) [jbossweb.jar:7.2.2.Final-redhat-1] at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:920) [jbossweb.jar:7.2.2.Final-redhat-1] at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_09-icedtea] 2014-03-06 10:34:17,797 INFO [org.ovirt.engine.core.bll.LogoutUserCommand] (ajp-/127.0.0.1:8702-11) [739775d6] Running command: LogoutUserCommand internal: false. 2014-03-06 10:34:17,807 INFO [org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector] (ajp-/127.0.0.1:8702-11) [739775d6] Correlation ID: 739775d6, Call Stack: null, Custom Event ID: -1, Message: User admin logged out. --- Additional comment from RHEL Product and Program Management on 2014-03-06 04:41:49 EST --- This bug report has Keywords: Regression or TestBlocker. Since no regressions or test blockers are allowed between releases, it is also being identified as a blocker for this release. Please resolve ASAP. --- Additional comment from Juan Hernández on 2014-03-06 05:19:46 EST --- This happens because in some parts of the RESTAPI we assume that the lists returned by the backend are ArrayLists. After the directory refactoring the backend returns an special implementation of the List interfaces for empty lists, the result of Collections.emptyList(), and that isn't an ArrayList. We need to stop assuming that the backend returns ArrayLists, and use the List interface instead. That is what the proposed patch is doing, for the particular case of this bug and for a couple of other cases.
This issue was detected in RHEV-M 3.4, but it also affects oVirt Engine 3.4.
Itamar, I discussed this bug with Sandro and we agreed that it is important enough to have it in 3.4.0. Why do you think it shouldn't?
Ok, I saw your comment in the change in gerrit. I'm retargeting to 3.4.0, as the original intention was to have it there.