fixed null pointer exceptions
This commit is contained in:
parent
36aa53273e
commit
54f3ad2bd2
|
@ -1,6 +1,7 @@
|
|||
package eu.dnetlib.repo.manager.domain;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class RepositoryInterface extends ApiDetails {
|
||||
|
@ -29,7 +30,10 @@ public class RepositoryInterface extends ApiDetails {
|
|||
public String getAccessSet() {
|
||||
Map<String, String> map;
|
||||
if (apiParams != null) {
|
||||
map = apiParams.stream().collect(Collectors.toMap(ApiParamDetails::getParam, ApiParamDetails::getValue));
|
||||
map = apiParams.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.filter(k -> k.getParam() == null && k.getValue() == null)
|
||||
.collect(Collectors.toMap(ApiParamDetails::getParam, ApiParamDetails::getValue));
|
||||
return map.get("set");
|
||||
}
|
||||
return null;
|
||||
|
@ -42,7 +46,10 @@ public class RepositoryInterface extends ApiDetails {
|
|||
public String getAccessFormat() {
|
||||
Map<String, String> map;
|
||||
if (apiParams != null) {
|
||||
map = apiParams.stream().collect(Collectors.toMap(ApiParamDetails::getParam, ApiParamDetails::getValue));
|
||||
map = apiParams.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.filter(k -> k.getParam() == null && k.getValue() == null)
|
||||
.collect(Collectors.toMap(ApiParamDetails::getParam, ApiParamDetails::getValue));
|
||||
return map.get("format");
|
||||
}
|
||||
return null;
|
||||
|
|
Loading…
Reference in New Issue