fix service discovery has identity

This commit is contained in:
kosyak 2023-08-15 01:23:18 +02:00
parent fee1a67332
commit 5ce1e80e73

View file

@ -85,7 +85,7 @@ public class ServiceDiscoveryResult {
}
}
}
private ServiceDiscoveryResult() {
this.hash = "sha-1";
this.features = Collections.emptyList();
@ -168,15 +168,19 @@ public class ServiceDiscoveryResult {
return this.features;
}
public boolean hasIdentity(String category, String type) {
public Identity getIdentity(String category, String type) {
for (Identity id : this.getIdentities()) {
if ((category == null || id.getCategory().equals(category)) &&
(type == null || id.getType().equals(type))) {
return true;
return id;
}
}
return false;
return null;
}
public boolean hasIdentity(String category, String type) {
return getIdentity(category, type) != null;
}
public String getExtendedDiscoInformation(String formType, String name) {
@ -239,8 +243,8 @@ public class ServiceDiscoveryResult {
return null;
}
return md.digest(s.toString().getBytes(StandardCharsets.UTF_8));
}
return md.digest(s.toString().getBytes(StandardCharsets.UTF_8));
}
private JSONObject toJSON() {
try {