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: Sun, 10 Jul 2016 20:22:15 +0000
  • Accept-language: en-US
  • Authentication-results: spf=none (sender IP is ) ;
  • Spamdiagnosticmetadata: NSPM
  • Spamdiagnosticoutput: 1:99

This is fixed in patch

grouper_v2_3_0_api_patch_16

https://bugs.internet2.edu/jira/browse/GRP-1303

Thanks
Chris

-----Original Message-----
From: Biernath, Jutta
[mailto:]

Sent: Tuesday, May 24, 2016 4:07 AM
To: Hyzer, Chris
<>;


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

For me it works now. I don't need another patch for 2.2

Thanks,

Jutta



--------------------
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
[mailto:]

Gesendet: Montag, 23. Mai 2016 20:36
An: Biernath, Jutta
<>;


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

Whoops, forgot link

https://github.com/Internet2/grouper/commit/4b1125fd0d2718225c7cdc43f01c2226131a9df7


-----Original Message-----
From: Hyzer, Chris
Sent: Monday, May 23, 2016 2:36 PM
To: 'Biernath, Jutta'
<>;


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

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

Thanks
Chris

-----Original Message-----
From: Biernath, Jutta
[mailto:]
Sent: Monday, May 23, 2016 4:24 AM
To: Hyzer, Chris
<>;


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

Hi, Chris,

Grouper Version 2.2

Source File:
grouper.edu.internet2.middleware.grouper.app.loader.db.GrouperLoaderResultset
=========================================================================


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 =
sourceToSubjectIdsOrIdentifiers.get(sourceId);
//lazy load for source
if (subjectIdsOrIdentifiersForSource == null) {
subjectIdsOrIdentifiersForSource = new HashSet<String>();
sourceToSubjectIdsOrIdentifiers.put(sourceId,
subjectIdsOrIdentifiersForSource);
}
subjectIdsOrIdentifiersForSource.add(subjectIdOrIdentifer);
} else {
//no source, just keep track of identifier
subjectIdsOrIdentifiers.add(subjectIdOrIdentifer);
}
### --> 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 =
SubjectFinder.findByIds(subjectIdsOrIdentifiers);
} else if (StringUtils.equals(subjectIdCol,
GrouperLoaderResultset.SUBJECT_IDENTIFIER_COL)) {
subjectIdOrIdentifierToSubject =
SubjectFinder.findByIdentifiers(subjectIdsOrIdentifiers);
} else if (StringUtils.equals(subjectIdCol,
GrouperLoaderResultset.SUBJECT_ID_OR_IDENTIFIER_COL)) {
subjectIdOrIdentifierToSubject =
SubjectFinder.findByIdsOrIdentifiers(subjectIdsOrIdentifiers);
} else {
throw new RuntimeException("Not expecting subjectIdCol: " +
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 =
sourceToSubjectIdOrIdentifierToSubject.get(sourceId);
if (localSubjectIdOrIdentifierToSubject != null) {
subject =
localSubjectIdOrIdentifierToSubject.get(subjectIdOrIdentifier);
}
}
} 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.


Regards,

Jutta






--------------------
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
[mailto:]
Gesendet: Freitag, 20. Mai 2016 18:27
An: Biernath, Jutta
<>;


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

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-----
From:


[mailto:]
On Behalf Of Jutta Biernath
Sent: Friday, May 20, 2016 7:04 AM
To:

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

Hi,

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
found:

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
branch.
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
relevant.

Regards,
Jutta Biernath
Freie Universität Berlin


  • RE: [grouper-users] Bug found in GrouperLoaderResultSet.bulkLookupSubjects(), Hyzer, Chris, 07/10/2016

Archive powered by MHonArc 2.6.19.

Top of Page