mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 01:54:22 +00:00
[DURACOM-109] fix TruncatedChunkException error
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
package org.dspace.external;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Scanner;
|
||||
@@ -51,7 +52,11 @@ public class OrcidRestConnector {
|
||||
}
|
||||
try (CloseableHttpClient httpClient = DSpaceHttpClientFactory.getInstance().build()) {
|
||||
getResponse = httpClient.execute(httpGet);
|
||||
result = getResponse.getEntity().getContent();
|
||||
try (InputStream responseStream = getResponse.getEntity().getContent()) {
|
||||
// Read all the content of the response stream into a byte array to prevent TruncatedChunkException
|
||||
byte[] content = responseStream.readAllBytes();
|
||||
result = new ByteArrayInputStream(content);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
getGotError(e, fullPath);
|
||||
}
|
||||
|
Reference in New Issue
Block a user