Project

General

Profile

Revision 7863

Added by Jing Tao over 7 years ago

Add the code to write the error message to the log in the itemRemvoed method.

View differences:

metacat-index/src/main/java/edu/ucsb/nceas/metacat/index/SystemMetadataEventListener.java
144 144

  
145 145
	public void itemRemoved(ItemEvent<SystemMetadata> entryEvent) {
146 146
		// remove from the index
147
		Identifier pid = entryEvent.getItem().getIdentifier();		
148
		try {
149
			solrIndex.remove(pid.getValue());
150
		} catch (Exception e) {
151
			// TODO: need to track errors, retry later
152
			log.error(e.getMessage(), e);
147
		Identifier pid = entryEvent.getItem().getIdentifier();
148
		if(pid != null) {
149
		    try {
150
	            solrIndex.remove(pid.getValue());
151
	        } catch (Exception e) {
152
	            String error = "SystemMetadataEventListener.itemRemoved - couldn't remove the index for the pid "+pid.getValue()+" since "+e.getMessage();
153
	            SystemMetadata systemMetadata = entryEvent.getItem();
154
	            writeEventLog(systemMetadata, pid, error);
155
	            log.error(error, e);
156
	        }
153 157
		}
154 158
		
159
		
155 160
	}
156 161

  
157 162
	public void itemAdded(ItemEvent<SystemMetadata> entryEvent) {
......
185 190
		    String error = "SystemMetadataEventListener.itemAdded - could not look up object path" + e.getMessage();
186 191
		    writeEventLog(systemMetadata, pid, error);
187 192
			log.error(error, e);
193
			return;
188 194
		}
189 195
		if(objectPath != null) {
190 196
		    InputStream data = null;

Also available in: Unified diff