Project

General

Profile

« Previous | Next » 

Revision f0d88d76

Added by Andreas Müller over 6 years ago

fix inadequate logging in stream partitioner

View differences:

cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/dwca/in/StreamPartitioner.java
95 95
			while (resultReader.hasNext()){
96 96
				MappedCdmBase<? extends CdmBase> item = resultReader.read();
97 97
				resultList.add(item);
98
				if (item.getCdmBase().isInstanceOf(IdentifiableEntity.class)) {
99
				    addItemToRelatedObjects((MappedCdmBase<IdentifiableEntity>)item);
100
				}else{
101
				    logger.error("Non identifiable objects can not be added to related objects yet");
102
				}
98
				addItemToRelatedObjects(item);
103 99
			}
104 100
			outStream.add(new ListReader<>(resultList));
105 101
		}
......
113 109
	 * Add new items to the local mapping
114 110
	 * @param item
115 111
	 */
116
	private void addItemToRelatedObjects(MappedCdmBase<? extends IdentifiableEntity> item) {
112
	private void addItemToRelatedObjects(MappedCdmBase<? extends CdmBase> item) {
117 113
		CdmBase cdmBase = item.getCdmBase();
118 114
		if (cdmBase.getId() == 0){
119 115
			if (cdmBase.isInstanceOf(IdentifiableEntity.class)){
116
			    IdentifiableEntity<?> identifiableEntity = CdmBase.deproxy(cdmBase, IdentifiableEntity.class);
120 117
			    Set<String> requiredSourceNamespaces = converter.requiredSourceNamespaces();
121 118
				if (requiredSourceNamespaces.contains(item.getNamespace())){
122
					state.addRelatedObject(item.getNamespace(), item.getSourceId(), item.getCdmBase());
119
					state.addRelatedObject(item.getNamespace(), item.getSourceId(), identifiableEntity);
123 120
				}
121
			}else{
122
			    if (logger.isTraceEnabled()){logger.trace("Non identifiable are not added to related objects");}
124 123
			}
125 124
		}
126 125
	}

Also available in: Unified diff