Skip to content
Snippets Groups Projects

fix(DepositDocSerializer): avoid NullPointerException when checking if a collaborator exists

Merged Nicolas.Rod requested to merge rodn-fix-isCollaboration-computing into master
1 file
+ 4
3
Compare changes
  • Side-by-side
  • Inline
@@ -9,12 +9,12 @@
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of the
* License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-2.0.html>.
@@ -79,7 +79,8 @@ public class DepositDocSerializer extends StdSerializer<DepositDoc> {
List<Serializable> contributorsOrCollaborations = null;
if (value.getContributors() != null) {
contributorsOrCollaborations = value.getContributors().getContributorOrCollaboration();
isCollaboration = contributorsOrCollaborations.stream().anyMatch(serializable -> serializable instanceof Contributor && ((Contributor)serializable).getRole().equals(COLLABORATOR));
isCollaboration = contributorsOrCollaborations.stream()
.anyMatch(s -> s instanceof Contributor contributor && COLLABORATOR.equals(contributor.getRole()));
}
contributorsFormStep.put("isCollaboration", isCollaboration);
contributorsFormStep.put("academicStructures", value.getAcademicStructures());
Loading