Commit 855a8d2743f7d631071bd8ac736f039873e77e99

Authored by Fernando Ribeiro
1 parent 096e61ea4c
Exists in DSpace52++

Corrected a possible null pointer exception when submitting with degois to saris…

…. It may be overprotected.
dspace-api/src/main/java/pt/uminho/sdum/submit/RestrictAccess.java
... ... @@ -36,8 +36,13 @@ public class RestrictAccess {
36 36  
37 37 public static void restrictItemAccess(Context context,Item item){
38 38  
39   - if(item.getMetadata("dc.rights").equals("restrictedAccess")
40   - || item.getMetadata("dc.rights").equals("closedAccess")) {
  39 + //Changed to correct null Pointer Exception
  40 + String dcRights = "";
  41 + if(item != null)
  42 + dcRights = item.getMetadata("dc.rights") != null ? item.getMetadata("dc.rights") : dcRights;
  43 +
  44 + //Changed to correct null Pointer Exception
  45 + if(dcRights.equals("restrictedAccess") || dcRights.equals("closedAccess")) {
41 46  
42 47 Group anonGroup = null;
43 48 try {
... ...