-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unhandled exception when retrieving already built incompatible payload #1600
Closed
chamil321 opened this issue
Jul 2, 2021
· 1 comment
· Fixed by ballerina-platform/module-ballerina-http#513
Closed
Unhandled exception when retrieving already built incompatible payload #1600
chamil321 opened this issue
Jul 2, 2021
· 1 comment
· Fixed by ballerina-platform/module-ballerina-http#513
Labels
Milestone
Comments
chamil321
added
Type/Bug
Priority/Blocker
module/http
Team/PCM
Protocol connector packages related issues
labels
Jul 2, 2021
Observed this error with caching client. Caching client build the payload with as blob first. The program retrieves the payload as json. But the payload type is xml. The thrown error by the json parser is caught but processed with null balfuture. Can be reproduced with service / on inResponseCachedPayloadListener {
resource function get checkJson() returns json|error {
http:Client diseaseEndpoint = check new ("http://localhost:" + inResponseCachedPayloadTestBEPort.toString());
http:Response resp = check diseaseEndpoint -> get("/getXml");
byte[] b = check resp.getBinaryPayload(); // represents cache behaviour
return resp.getJsonPayload();
}
}
service / on inResponseCachedPayloadBEListener {
resource function get getXml(http:Caller caller) {
http:Response response = new;
xml xmlStr = xml `<name>Ballerina</name>`;
response.setXmlPayload(xmlStr);
error? result = caller->respond(response);
}
} or service / on inResponseCachedPayloadListener {
resource function get checkJson() returns json|error {
http:Client diseaseEndpoint = check new ("http://localhost:" + inResponseCachedPayloadTestBEPort.toString());
http:Response resp = check diseaseEndpoint -> get("/getXml");
return resp.getJsonPayload();
}
}
service / on inResponseCachedPayloadBEListener {
resource function get getXml(http:Caller caller) {
http:Response response = new;
xml xmlStr = xml `<name>Ballerina</name>`;
response.setXmlPayload(xmlStr);
// enables cache behaviour
response.setHeader("Cache-Control", "public, max-age=14400");
response.setHeader("etag", "W/\"25f-VB/B7cwRxpkTFPnufB0QcTCzHUE\"");
error? result = caller->respond(response);
}
} |
3 tasks
chamil321
changed the title
Unhandled NPE when retrieving payload
Unhandled exception when retrieving already built incompatible payload
Jul 5, 2021
Merged
3 tasks
40 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description:
Execptions thrown from https://github.com/ballerina-platform/module-ballerina-http/blob/d5e06bea9b722923ac033491fffa711f70b28f7e/http-native/src/main/java/org/ballerinalang/net/http/nativeimpl/ExternHttpDataSourceBuilder.java#L92 are catched and processed with NULL balFuture
Steps to reproduce:
Client
Affected Versions:
beta1
OS, DB, other environment details and versions:
Related Issues (optional):
Suggested Labels (optional):
Suggested Assignees (optional):
The text was updated successfully, but these errors were encountered: