Java string limit 64kb, longer than Trip Parser's input
Description
Tried to implemented support for Trip Parser #28. The string created for the POST can't be handled because it exceeds the 64kb limit and returns the error "constant string too long".
Steps to Reproduce
Switch to https://github.com/amadeus4dev/amadeus-java/pull/59 and run the following code by replacing the base64string with the actual base64 from the swagger.
String body = "{\"data\":{\"type\":\"trip-parser-job\",\"content\":\"base64string\"}}"; TripParser tripParser = amadeus.travel.tripParserJobs.post(body);
Expected Behavior: Starts parsing job
Actual Behavior: constant string too long
Hi @tsolakoua I can try helping out with this - pls let me know if its ok. Thank you.
Hello @chaudharydeepak. Thank you so much for your interest in the issue. Definitely, feel free to have a look at it. At any point let us know if you need more information or anything that could be useful. To help you get started, make sure you went through the contributor's guide.
Closed with https://github.com/amadeus4dev/amadeus-java/pull/104
Hello, If the issue is still there I am suggesting to change the body field in the request to byte[] instead of String and create related method for String to be backward compatible. Like the below :
public class Request {
private byte[] body;
public byte[] getBody() {
return body;
}
public void setBody(byte[] body) {
this.body = body;
}
public String getBodyString() {
return Arrays.toString(body);
}
public void setBodyString(String body) {
this.body = body.getBytes(StandardCharsets.UTF_8);
}
}
It seems that 64K limitation is not there for byte[] and if someone wants to send a really big body (more than 64K) then should use related setBody with byte[] input. Do you think this can help ?
_Hamid