Skip to Content.
Sympa Menu

grouper-users - RE: [grouper-users] Bug found in GrouperLoaderResultSet.bulkLookupSubjects()

Subject: Grouper Users - Open Discussion List

List archive

RE: [grouper-users] Bug found in GrouperLoaderResultSet.bulkLookupSubjects()

Chronological Thread 
  • From: "Hyzer, Chris" <>
  • To: "Biernath, Jutta" <>, "" <>
  • Subject: RE: [grouper-users] Bug found in GrouperLoaderResultSet.bulkLookupSubjects()
  • Date: Mon, 23 May 2016 18:35:39 +0000
  • Accept-language: en-US
  • Authentication-results:; dkim=none (message not signed) header.d=none;; dmarc=none action=none;
  • Spamdiagnosticmetadata: NSPM
  • Spamdiagnosticoutput: 1:23

Would this solve your issue? Do you think we need a patch in 2.2 or just a
patch and fix in 2.3+ ? If you have a workaround Im inclined to make a
patch only in 2.3


-----Original Message-----
From: Biernath, Jutta

Sent: Monday, May 23, 2016 4:24 AM
To: Hyzer, Chris

Subject: AW: [grouper-users] Bug found in

Hi, Chris,

Grouper Version 2.2

Source File:

Assignment of sourceIdCol:
(line 99)
String sourceIdCol = null;
(line 130-134)
String subjectSourceId = (String) row.getCell(
GrouperLoaderResultset.SUBJECT_SOURCE_ID_COL, false);
if (!StringUtils.isBlank(subjectSourceId)) {
sourceIdCol = GrouperLoaderResultset.SUBJECT_SOURCE_ID_COL;
### --> sourceIdCol stays null

Assignment of sourceId:
(line 136)
String sourceId = null;
(line 138-143)
if (!StringUtils.isBlank(sourceIdCol)) {
sourceId = (String) row.getCell(
GrouperLoaderResultset.SUBJECT_SOURCE_ID_COL, false);
//default this to what is in the config file
sourceId = StringUtils.defaultString(sourceId, defaultSubjectSourceId);
### -->sourceId gets default value

subjectIdsOrIdentifiers does not get any value:
(line 93)
Set<String> subjectIdsOrIdentifiers = new HashSet<String>();
(line 146-157)
if (!StringUtils.isBlank(sourceId)) {
Set<String> subjectIdsOrIdentifiersForSource =
//lazy load for source
if (subjectIdsOrIdentifiersForSource == null) {
subjectIdsOrIdentifiersForSource = new HashSet<String>();
} else {
//no source, just keep track of identifier
### --> sourceId has a value, so I never get into else branch -->
subjectIdsOrIdentifiers will never get any values; It stays an empty HashMap

subjectIdOrIdentifierToSubject does not get any value:
(line 194)
Map<String, Subject> subjectIdOrIdentifierToSubject = null;
(line 196-207)
if (GrouperUtil.length(subjectIdsOrIdentifiers) > 0) {
//what are they?
if (StringUtils.equals(subjectIdCol,
GrouperLoaderResultset.SUBJECT_ID_COL)) {
subjectIdOrIdentifierToSubject =
} else if (StringUtils.equals(subjectIdCol,
GrouperLoaderResultset.SUBJECT_IDENTIFIER_COL)) {
subjectIdOrIdentifierToSubject =
} else if (StringUtils.equals(subjectIdCol,
GrouperLoaderResultset.SUBJECT_ID_OR_IDENTIFIER_COL)) {
subjectIdOrIdentifierToSubject =
} else {
throw new RuntimeException("Not expecting subjectIdCol: " +
### --> subjectIdsOrIdentifiers is still empty, so I don't get into
if-clause. But just here in this if-clause the values are assigned to
subjectIdOrIdentifierToSubject --> there are never values assigned to
subjectIdOrIdentifierToSubject; It stays null.

Null pointer exception
(line 215-226)
if (!StringUtils.isBlank(sourceIdCol)) {
String sourceId = (String)row.getCell(sourceIdCol, false);
if (!StringUtils.isBlank(sourceId)) {
Map<String, Subject> localSubjectIdOrIdentifierToSubject =
if (localSubjectIdOrIdentifierToSubject != null) {
subject =
} else {
//get the subject from the subjectId map
subject = subjectIdOrIdentifierToSubject.get(subjectIdOrIdentifier);
### --> StringUtils.isBlank(sourceIdCol) is true if sourceIdCol is null or
empty. My sourceIdCol is still null, see above, so I get into the else branch
here. But in the else branch the get-Method tries to get a value from
subjectIdOrIdentifierToSubject, which is still null --> a null pointer
exception occurs.



Jutta Biernath
Freie Universität Berlin
Zentraleinrichtung für Datenverarbeitung (ZEDAT)
Identity & Customer Management, FUDIS
Fabeckstr. 32
14195 Berlin
Tel. +49 30 838-75090
Fax +49 30 838-475090

-----Ursprüngliche Nachricht-----
Von: Hyzer, Chris

Gesendet: Freitag, 20. Mai 2016 18:27
An: Biernath, Jutta

Betreff: RE: [grouper-users] Bug found in

Can you please give source file names and when referencing a source line give
the line number and copy the source line too? Thanks, Chris

-----Original Message-----

On Behalf Of Jutta Biernath
Sent: Friday, May 20, 2016 7:04 AM

Subject: [grouper-users] Bug found in


after upgrading Grouper from 2.1.5 to 2.2.2 I have encountered several
NullPointerExceptions when running loadergroups. I have carefully analysed
the source code because I wanted to understand the cause. This is what I

I have several loadergroups, each one with another view as resultset. Some of
the views have a source_id column, others haven't (those which don't build a
group hierarchy).

Now the NullPointerException occured with the loadergroups with resultsets
without source_id column. This is what happened:

- I have a default source id set in the loader properties file, so this is <>
null; this value is assigned to the variable sourceId
- However I don't have a source column in the resultset, what means that the
variable sourceIdCol stays null
- Because sourceId has a valid value, the variable subjectIdsOrIdentifiers
stays null; there are no values assigned to it.
- Because subjectIdsOrIdentifiers is null, also
subjectIdOrIdentifierToSubject is null.
- In ln. 218 however there is an if/else command that checks if sourceIdCol
is blank or not. My sourceIdCol is still null, so i get into the the else
But there is a get()-Method on subjectIdOrIdentifierToSubject, which was
never filled, see above --> a NullPointerException happens. Probably you
wanted to check if sourceId was blank, not sourceIdCol.

Until this is fixed I will work with a workaround, giving all of my views a
column for the subject source. I just wanted to inform you, I think this is

Jutta Biernath
Freie Universität Berlin

Archive powered by MHonArc 2.6.16.

Top of Page