[CST-5303] fix bug with decoded doi

This commit is contained in:
Mykhaylo
2022-05-13 00:46:21 +02:00
parent 0c377fd08a
commit 38ef693a5b
2 changed files with 4 additions and 2 deletions

View File

@@ -7,6 +7,7 @@
*/
package org.dspace.importer.external.crossref;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
@@ -189,7 +190,8 @@ public class CrossRefImportMetadataSourceServiceImpl extends AbstractImportMetad
@Override
public List<ImportRecord> call() throws Exception {
List<ImportRecord> results = new ArrayList<>();
URIBuilder uriBuilder = new URIBuilder(url + "/" + query.getParameterAsClass("id", String.class));
String ID = URLDecoder.decode(query.getParameterAsClass("id", String.class), "UTF-8");
URIBuilder uriBuilder = new URIBuilder(url + "/" + ID);
String responseString = liveImportClient.executeHttpGetRequest(1000, uriBuilder.toString(),
new HashMap<String, String>());
JsonNode jsonNode = convertStringJsonToJsonNode(responseString);

View File

@@ -60,7 +60,7 @@ public class LiveImportClientImpl implements LiveImportClient {
HttpResponse httpResponse = httpClient.execute(method);
if (isNotSuccessfull(httpResponse)) {
throw new RuntimeException();
throw new RuntimeException("The request failed with: " + getStatusCode(httpResponse) + " code");
}
InputStream inputStream = httpResponse.getEntity().getContent();
return IOUtils.toString(inputStream, Charset.defaultCharset());