Project

General

Profile

« Previous | Next » 

Revision 7214

Added by Chris Jones over 12 years ago

Only add an AccessPolicy to SystemMetadata during generation when the AccessPolicy is not empty. We've had some scenarios where IdentifierManager.getaccessPolicy() is returning an empty policy because of an empty permission list coming from the db. This was causing InvalidSystemMetadata exceptions during MN to MN replication.

View differences:

src/edu/ucsb/nceas/metacat/dataone/SystemMetadataFactory.java
57 57
import org.dataone.service.exceptions.BaseException;
58 58
import org.dataone.service.exceptions.NotFound;
59 59
import org.dataone.service.types.v1.AccessPolicy;
60
import org.dataone.service.types.v1.AccessRule;
60 61
import org.dataone.service.types.v1.Checksum;
61 62
import org.dataone.service.types.v1.Identifier;
62 63
import org.dataone.service.types.v1.NodeReference;
......
293 294
		
294 295
		// look up the access control policy we have in metacat
295 296
		AccessPolicy accessPolicy = IdentifierManager.getInstance().getAccessPolicy(guid);
296
		sysMeta.setAccessPolicy(accessPolicy);
297
		try {
298
        List<AccessRule> allowList = accessPolicy.getAllowList();
299
        sysMeta.setAccessPolicy(accessPolicy);
300
        
301
    } catch (NullPointerException npe) {
302
        logMetacat.info("The allow list is empty, can't include an empty " +
303
            "access policy in the system metadata for " + guid);
304
        
305
    }
297 306
		
298 307
		// authoritative node
299 308
		NodeReference nr = new NodeReference();

Also available in: Unified diff