diff --git a/src/main/java/uniresolver/driver/did/indy/DidIndyDriver.java b/src/main/java/uniresolver/driver/did/indy/DidIndyDriver.java index d6e697f..bfc818e 100644 --- a/src/main/java/uniresolver/driver/did/indy/DidIndyDriver.java +++ b/src/main/java/uniresolver/driver/did/indy/DidIndyDriver.java @@ -216,7 +216,7 @@ public ResolveDataModelResult resolve(DID did, Map resolveOption throw new ResolutionException("Cannot send GET_ATTR request: " + ex.getMessage(), ex); } - if (getAttrResponse == null) { + if (! TransactionData.hasData(getAttrResponse)) { try { synchronized (indyConnection) { Pool.setProtocolVersion(indyConnection.getPoolVersion()); diff --git a/src/main/java/uniresolver/driver/did/indy/ledger/TransactionData.java b/src/main/java/uniresolver/driver/did/indy/ledger/TransactionData.java index 286bdda..685542e 100644 --- a/src/main/java/uniresolver/driver/did/indy/ledger/TransactionData.java +++ b/src/main/java/uniresolver/driver/did/indy/ledger/TransactionData.java @@ -173,6 +173,17 @@ public static TransactionData fromGetAttrResponse(Map getAttrRes } } + public static boolean hasData(String getAttrResponse) { + try { + Map getTxnResponseMap = objectMapper.readValue(getAttrResponse, Map.class); + Object jsonGetAttrResult = getTxnResponseMap == null ? null : getTxnResponseMap.get("result"); + Object jsonGetAttrResultDataString = !(jsonGetAttrResult instanceof Map) ? null : ((Map) jsonGetAttrResult).get("data"); + return jsonGetAttrResultDataString != null; + } catch (JsonProcessingException ex) { + throw new IllegalArgumentException("Cannot parse transaction " + getAttrResponse + ": " + ex.getMessage(), ex); + } + } + public boolean isNym() { return "1".equals(this.getType()); }