------------------------------------------------------------ revno: 16729 committer: Morten Olav Hansen <morte...@gmail.com> branch nick: dhis2 timestamp: Tue 2014-09-16 12:20:02 +0700 message: minor npe check modified: dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/HibernateGenericStore.java
-- lp:dhis2 https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk Your team DHIS 2 developers is subscribed to branch lp:dhis2. To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/HibernateGenericStore.java' --- dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/HibernateGenericStore.java 2014-09-15 14:37:25 +0000 +++ dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/HibernateGenericStore.java 2014-09-16 05:20:02 +0000 @@ -191,7 +191,7 @@ { Criteria criteria = sessionFactory.getCurrentSession().createCriteria( getClazz(), "c" ).setCacheable( cacheable ); - if ( !sharingEnabled() ) + if ( !sharingEnabled() || user == null ) { return criteria; } @@ -253,7 +253,7 @@ * @param expressions the Criterions for the Criteria. * @return an object of the implementation Class type. */ - @SuppressWarnings( "unchecked" ) + @SuppressWarnings("unchecked") protected final T getObject( Criterion... expressions ) { return (T) getCriteria( expressions ).uniqueResult(); @@ -265,7 +265,7 @@ * @param expressions the Criterions for the Criteria. * @return a List with objects of the implementation Class type. */ - @SuppressWarnings( "unchecked" ) + @SuppressWarnings("unchecked") protected final List<T> getList( Criterion... expressions ) { return getCriteria( expressions ).list(); @@ -336,7 +336,7 @@ } @Override - @SuppressWarnings( "unchecked" ) + @SuppressWarnings("unchecked") public final T get( int id ) { T object = (T) sessionFactory.getCurrentSession().get( getClazz(), id ); @@ -351,7 +351,7 @@ } @Override - @SuppressWarnings( "unchecked" ) + @SuppressWarnings("unchecked") public final T load( int id ) { T object = (T) sessionFactory.getCurrentSession().load( getClazz(), id ); @@ -383,7 +383,7 @@ } @Override - @SuppressWarnings( "unchecked" ) + @SuppressWarnings("unchecked") public final List<T> getAll() { return getSharingCriteria().list(); @@ -446,8 +446,8 @@ protected boolean sharingEnabled() { - return forceAcl() || ( aclService.isShareable( clazz ) && !( currentUserService.getCurrentUser() == null || - CollectionUtils.containsAny( currentUserService.getCurrentUser().getUserCredentials().getAllAuthorities(), AclService.ACL_OVERRIDE_AUTHORITIES ) ) ); + return forceAcl() || (aclService.isShareable( clazz ) && !(currentUserService.getCurrentUser() == null || + CollectionUtils.containsAny( currentUserService.getCurrentUser().getUserCredentials().getAllAuthorities(), AclService.ACL_OVERRIDE_AUTHORITIES ))); } protected boolean isReadAllowed( T object )
_______________________________________________ Mailing list: https://launchpad.net/~dhis2-devs Post to : dhis2-devs@lists.launchpad.net Unsubscribe : https://launchpad.net/~dhis2-devs More help : https://help.launchpad.net/ListHelp