Revision 47488
Added by Claudio Atzori almost 7 years ago
modules/dnet-mapreduce-jobs/trunk/src/main/java/eu/dnetlib/data/mapreduce/hbase/broker/SubjectEventFactory.java | ||
---|---|---|
13 | 13 |
import eu.dnetlib.data.proto.OafProtos.Oaf; |
14 | 14 |
import eu.dnetlib.data.proto.OafProtos.OafEntity; |
15 | 15 |
import eu.dnetlib.data.proto.ResultProtos.Result.Metadata; |
16 |
import org.apache.commons.lang.StringUtils; |
|
16 | 17 |
import org.apache.hadoop.io.Text; |
17 | 18 |
import org.apache.hadoop.mapreduce.Reducer.Context; |
18 | 19 |
import org.dom4j.DocumentException; |
... | ... | |
79 | 80 |
context.getCounter("events skipped", "SUBJECT not mapped").increment(1); |
80 | 81 |
return; |
81 | 82 |
} |
82 |
final float adjustedTrust = trust * Float.valueOf(subjectOther.getDataInfo().getTrust()); |
|
83 |
// we got java.lang.NumberFormatException: empty String, because of empty trust values. Default to 1.0 in such cases |
|
84 |
final String t = subjectOther.getDataInfo().getTrust(); |
|
85 |
final float adjustedTrust = trust * Float.valueOf(StringUtils.isBlank(t) ? "1.0" : t); |
|
83 | 86 |
final Oaf.Builder prototype = Oaf.newBuilder(current); |
84 | 87 |
prototype.getEntityBuilder().getResultBuilder().getMetadataBuilder().addSubject(subjectOther); |
85 | 88 |
final Oaf oaf = prototype.build(); |
Also available in: Unified diff
it seems we need to manage empty trust values...