changed the way info is produced for the patch. If no interesting refereed info is present, the association result info is not produced

This commit is contained in:
Miriam Baglioni 2020-07-06 13:57:37 +02:00
parent a4f9052623
commit 8d1c12bd18
2 changed files with 13 additions and 12 deletions

View File

@ -140,21 +140,19 @@ public class SparkPatchRefereed implements Serializable {
// ri.getHostedby().equals(i.getHostedby()) &&
// ri.getInstancetype().equals(i.getInstancetype()) &&
equals(ri.getUrl(), i.getUrl())) {
Optional<Qualifier> oRefereed = Optional.ofNullable(i.getRefereed());
if (!oRefereed.isPresent()) {
if (ri.getRefereed().getClassid().equals("")) {
i.setRefereed(Constants.DEFAULT_REFEREED);
} else {
i.setRefereed(ri.getRefereed());
}
}
// Optional<Qualifier> oRefereed = Optional.ofNullable(i.getRefereed());
// if (!oRefereed.isPresent()) {
// if (!(ri.getRefereed().getClassid().equals("") ||
// ri.getRefereed().getClassid().equals(Constants.DEFAULT_REFEREED.getClassid()))) {
i.setRefereed(ri.getRefereed());
return true;
// }
}
return false;
}
// TODO verify the reason of the NullPointerException fired at line 167
private static boolean equals(List<String> url, List<String> url1) {
public static boolean equals(List<String> url, List<String> url1) {
try {
if (url == null && url1 == null) {
return true;

View File

@ -97,10 +97,13 @@ public class SparkPrepareResultInstanceList implements Serializable {
.map(instance -> {
Optional<Qualifier> oRefereed = Optional.ofNullable(instance.getRefereed());
if (oRefereed.isPresent()) {
return instance;
} else {
return null;
if (!(oRefereed.get().getClassid().equals(Constants.DEFAULT_REFEREED.getClassid()) ||
oRefereed.get().getClassid().equals("UNKNOWN") ||
oRefereed.get().getClassid().equals(""))) {
return instance;
}
}
return null;
})
.filter(Objects::nonNull)
.collect(Collectors.toList()))