Moti Asayag has posted comments on this change.

Change subject: core: Make DAOs injectable
......................................................................


Patch Set 1:

(1 comment)

http://gerrit.ovirt.org/#/c/35793/1/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/DbFacade.java
File 
backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/DbFacade.java:

Line 269:     protected <T extends DAO> T getDao(Class<T> daoType) {
Line 270:         @SuppressWarnings("unchecked")
Line 271:         Set<T> daos = (Set<T>) beanManager.getBeans(daoType, 
(Annotation[]) null);
Line 272:         if (daos.size() == 0) {
Line 273:             log.error("Can't find dao for " + daoType);
I'd replace lines 272-275 with an assertion, as this is clearly a code bug.

Using org.apache.commons.lang.Validate:

  Validate.notEmpty(daos, "Can't find dao for " + daoType);
Line 274:             return null;
Line 275:         }
Line 276:         T dao = daos.iterator().next();
Line 277:         if (dao instanceof BaseDAODbFacade && !(dao instanceof 
HibernateFacade)) {


-- 
To view, visit http://gerrit.ovirt.org/35793
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ia408a878fa0fa8dd8b414a60683c36d0db6d6641
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Liran Zelkha <lzel...@redhat.com>
Gerrit-Reviewer: Moti Asayag <masa...@redhat.com>
Gerrit-Reviewer: automat...@ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to