ome/omero-server

NPE from AdminImpl.setDefaultGroup

Opened this issue · 1 comments

mtbc commented

https://www.openmicroscopy.org/qa2/qa/feedback/27735/ reports from probably removing a user from a group on OMERO 5.4.3,

ome.conditions.InternalException: Wrapped Exception: (java.lang.NullPointerException):
null
at ome.model.meta.Experimenter.findGroupExperimenterMap(Experimenter.java:471)
at sun.reflect.GeneratedMethodAccessor6320.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:198)
at ome.model.meta.Experimenter_$$_javassist_162.findGroupExperimenterMap(Experimenter_$$_javassist_162.java)
at ome.security.auth.SimpleRoleProvider.setDefaultGroup(SimpleRoleProvider.java:137)
at ome.logic.AdminImpl.setDefaultGroup(AdminImpl.java:841)

Maybe the fault's in OMERO.web but if so then the server should at least handle the circumstance better. An important clue might be the comment fragment,

I used HeidiSQL to access the table "groupexperimentermap" and discovered that all groups associated with me (those with my user ID in "child") did not have a "child_index" of 0.

How did that happen?

    /**
     * find all ome.model.meta.GroupExperimenterMap which have the argument as their parent.
     */
    public java.util.Set<ome.model.meta.GroupExperimenterMap> findGroupExperimenterMap( ome.model.meta.ExperimenterGroup target ) {
        if (! _loaded ) errorIfUnloaded();

        final java.util.Iterator<ome.model.meta.GroupExperimenterMap> it = iterateGroupExperimenterMap();
        final java.util.Set<ome.model.meta.GroupExperimenterMap> result = new java.util.HashSet<ome.model.meta.GroupExperimenterMap>();
        while ( it.hasNext() ) {
            ome.model.meta.GroupExperimenterMap link = it.next();
            if ( link.parent() == target ) { // <-- line 471 in the generated code
                result.add( link );
            }
        }
        return result;
    }

see: