oci-java-sdk
oci-java-sdk copied to clipboard
Truncated response data for operations that return binary data in versions 2.0.0 to 2.13.0 (Fixed in 2.13.1 and later)
If you're using the OCI Java SDK for calling any of the below listed API operations that return a stream of data but don't return the content-length header in the response, then you are most-likely affected by truncated data issue, caused due the SDK prematurely auto closing the stream before reading all the data.
Affected operations
This happens for both synchronous and asynchronous clients for the following operations : getJobTfConfig getJobTfState getStackTfConfig getStackTfState getTemplateLogo getTemplateTfConfig exportQueryResult synchronousExportDataAsset And possibly for the following API operations : getJobOutputContent getCpeDeviceConfigContent getIpsecCpeDeviceConfigContent getTunnelCpeDeviceConfigContent downloadPdfContent
Affected versions
This issue only occurs in OCI SDK versions >= 2.0.0
and <= 2.13.0
. The fix has been released in version 2.13.1
and later versions.
Detailed Explanation
This issue occurs due to this bug in the Jersey library's ApacheConnector
which results in -1
content-length when the service does not respond back with a content-length header. This causes the wrapped response stream to close before the entire data has been read from the stream.
Workaround
If you're using any of the versions between 2.0.0
and 2.13.0
, you can avoid hitting the above issue by switching back to the Jersey default HttpUrlConnector
for the OCI SDK by following any of the methods mentioned here.
Since the fix has been released in the versions 2.13.1
and later, you can alternatively choose to upgrade to the fixed versions. However, for the above API operations, make sure to explicitly close the response stream for purposes mentioned here