Project

General

Profile

« Previous | Next » 

Revision 6904

Added by Chris Jones over 12 years ago

In IdentifierManager.updateSystemMetadata(), add a check for invalid system metadata (fields that throw a NullPointerException on access) to ensure that system metadata is populated correctly. Updated calling classes to handle the exception.

View differences:

GenerateSystemMetadata.java
33 33
import org.apache.commons.logging.Log;
34 34
import org.apache.commons.logging.LogFactory;
35 35
import org.dataone.service.exceptions.InvalidRequest;
36
import org.dataone.service.exceptions.InvalidSystemMetadata;
36 37
import org.dataone.service.exceptions.InvalidToken;
37 38
import org.dataone.service.exceptions.NotAuthorized;
38 39
import org.dataone.service.exceptions.NotFound;
......
138 139
     * @throws InvalidToken 
139 140
     * @throws PropertyNotFoundException 
140 141
     * @throws McdbDocNotFoundException 
142
     * @throws InvalidSystemMetadata 
141 143
     */
142 144
    public void generateMissingSystemMetadata(String localId, boolean includeOre, boolean downloadData) 
143 145
    throws ServiceFailure, McdbDocNotFoundException, PropertyNotFoundException, InvalidToken, NotAuthorized,
144
    NotFound, NotImplemented, InvalidRequest, NoSuchAlgorithmException, AccessionNumberException, SQLException 
146
    NotFound, NotImplemented, InvalidRequest, NoSuchAlgorithmException, AccessionNumberException, SQLException, InvalidSystemMetadata 
145 147
    {
146 148
    	log.debug("generateMissingSystemMetadata() called.");
147 149
    	log.debug("Creating SystemMetadata for localId " + localId);
......
161 163
        //insert the systemmetadata object or just update it as needed
162 164
        boolean exists = IdentifierManager.getInstance().systemMetadataExists(sm.getIdentifier().getValue());
163 165
        if (!exists) {
164
        	IdentifierManager.getInstance().createSystemMetadata(sm);
166
        	IdentifierManager.getInstance().createSystemMetadata(sm);        	
165 167
        }
166 168
        IdentifierManager.getInstance().updateSystemMetadata(sm);
167 169

  

Also available in: Unified diff