I tried to use Runtime.compileScript.
This returns two optional parameters. If they are not present, then ChromeDevToolsSession.parseChromeResponse() throws a NoSuchElementException when calling:
JsonNode first = elements.next();
The fix seems simple:
Iterator<JsonNode> elements = response.getResult().elements();
try {
// We do our best to predict which kind of result to consume the response as, but there's
// a small chance that a multi-result response has optional, absent members, and we try and
// fail to parse it as a single-result response, which is why we catch the inner JsonMappingException.
JsonNode first = elements.next(); // MOVED INTO TRY BLOCK
if (elements.hasNext()) {
return objectMapper.readValue(response.getResult().toString(), valueType);
} else {
return objectMapper.readValue(objectMapper.treeAsTokens(first), valueType);
}
} catch (JsonMappingException | NoSuchElementException e) { // CATCH NoSuchElementException
try {
return objectMapper.readValue(response.getResult().toString(), valueType);
} catch (IOException e1) {
throw new ChromeDevToolsException(e1);
}
} catch (IOException e2) {
throw new ChromeDevToolsException(e2);
}
- Move
JsonNode first = elements.next() into try block
- Catch
NoSuchElementException
@pschoenfelder it looks like you have recently updated this repo. My recent pull request has not been actioned. Can you let me know if HubSpot is happy for external submissions and if so who I ask. Thanks in advance!
I tried to use Runtime.compileScript.
This returns two optional parameters. If they are not present, then
ChromeDevToolsSession.parseChromeResponse()throws aNoSuchElementExceptionwhen calling:The fix seems simple:
JsonNode first = elements.next()into try blockNoSuchElementException@pschoenfelder it looks like you have recently updated this repo. My recent pull request has not been actioned. Can you let me know if HubSpot is happy for external submissions and if so who I ask. Thanks in advance!