Project

General

Profile

« Previous | Next » 

Revision 49526

check for null targets

View differences:

modules/dnet-parthenos-publisher/trunk/src/main/java/eu/dnetlib/parthenos/registry/GCubeResourceRegistrator.java
260 260
			if (obj == null) throw new ParthenosPublisherException(String.format("No target resource available for %s --> %s", subject.getURI(), rel.getURI()));
261 261
			ParthenosRegistryResource source = idMap.get(subject.getURI());
262 262
			ParthenosRegistryResource target = idMap.get(obj.getURI());
263
			String relJson = relWriter
264
					.writeRelationship(jsonFactory, rel.getLocalName(), source.getUuid(), source.getRegistryType(), target.getUuid(), target.getRegistryType());
265
			this.resourceRegistryPublisher.createIsRelatedTo(rel.getLocalName(), relJson);
266
			relCount++;
263
			if(target == null){
264
				log.error("Can't create rel "+rel.getLocalName()+" among "+subject.getURI()+" and "+obj.getURI());
265
			}
266
			else {
267
				String relJson = relWriter
268
						.writeRelationship(jsonFactory, rel.getLocalName(), source.getUuid(), source.getRegistryType(), target.getUuid(),
269
								target.getRegistryType());
270
				this.resourceRegistryPublisher.createIsRelatedTo(rel.getLocalName(), relJson);
271
				relCount++;
272
			}
267 273
		}
268 274
		return relCount;
269 275
	}

Also available in: Unified diff