Skip to content

Commit

Permalink
Fix NPE
Browse files Browse the repository at this point in the history
  • Loading branch information
Gcolon021 committed Feb 14, 2024
1 parent 087f528 commit 3a54b74
Showing 1 changed file with 3 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -160,19 +160,12 @@ private Set<Privilege> addNhanesPrivileges(Set<Privilege> privileges) {
if (privileges == null) {
privileges = new HashSet<>();
}

String consent_concept_path = JAXRSConfiguration.fence_parent_consent_group_concept_path;
if (!consent_concept_path.contains("\\\\")) {
//these have to be escaped again so that jaxson can convert it correctly
consent_concept_path = consent_concept_path.replaceAll("\\\\", "\\\\\\\\");
logger.debug(consent_concept_path);
}

String studyIdentifierField = "nhanes";
Privilege nhanesPriv = privilegeRepository.getUniqueResultByColumn("name", "nhanes");
if (nhanesPriv == null) {
nhanesPriv = new Privilege();
String queryTemplateText = createQueryTemplate(consent_concept_path, studyIdentifierField);
String queryTemplateText = createQueryTemplate(studyIdentifierField);
nhanesPriv.setQueryTemplate(queryTemplateText);
privilegeRepository.persist(nhanesPriv);
privileges.add(nhanesPriv);
Expand All @@ -183,9 +176,9 @@ private Set<Privilege> addNhanesPrivileges(Set<Privilege> privileges) {
return privileges;
}

private static String createQueryTemplate(String consent_concept_path, String studyIdentifierField) {
private static String createQueryTemplate(String studyIdentifierField) {
return "{\"categoryFilters\": {\""
+ consent_concept_path
+ "\\\\_consents\\\\"
+ "\":[\""
+ studyIdentifierField
+ "\"]},"
Expand Down

0 comments on commit 3a54b74

Please sign in to comment.