1
0
Fork 0

code formatting

This commit is contained in:
Claudio Atzori 2023-05-02 11:05:37 +02:00
parent f653640cd9
commit d02916ef82
1 changed files with 13 additions and 25 deletions

View File

@ -9,13 +9,13 @@ import java.util.concurrent.TimeUnit;
import org.apache.http.HttpHeaders;
import org.apache.http.entity.ContentType;
import org.jetbrains.annotations.NotNull;
import com.google.gson.Gson;
import eu.dnetlib.dhp.common.api.zenodo.ZenodoModel;
import eu.dnetlib.dhp.common.api.zenodo.ZenodoModelList;
import okhttp3.*;
import org.jetbrains.annotations.NotNull;
public class ZenodoAPIClient implements Serializable {
@ -155,7 +155,6 @@ public class ZenodoAPIClient implements Serializable {
conn.setDoOutput(true);
conn.setRequestMethod("PUT");
try (OutputStream os = conn.getOutputStream()) {
byte[] input = metadata.getBytes("utf-8");
os.write(input, 0, input.length);
@ -169,7 +168,6 @@ public class ZenodoAPIClient implements Serializable {
return responseCode;
}
private boolean checkOKStatus(int responseCode) {
@ -233,7 +231,6 @@ public class ZenodoAPIClient implements Serializable {
conn.setDoOutput(true);
conn.setRequestMethod("POST");
try (OutputStream os = conn.getOutputStream()) {
byte[] input = json.getBytes("utf-8");
os.write(input, 0, input.length);
@ -296,7 +293,6 @@ public class ZenodoAPIClient implements Serializable {
ZenodoModel zenodoModel = new Gson().fromJson(body, ZenodoModel.class);
bucket = zenodoModel.getLinks().getBucket();
return responseCode;
}
@ -331,8 +327,6 @@ public class ZenodoAPIClient implements Serializable {
conn.setDoOutput(true);
conn.setRequestMethod("GET");
String body = getBody(conn);
int responseCode = conn.getResponseCode();
@ -341,12 +335,8 @@ public class ZenodoAPIClient implements Serializable {
if (!checkOKStatus(responseCode))
throw new IOException("Unexpected code " + responseCode + body);
return body;
}
private String getBucket(String inputUurl) throws IOException {
@ -370,8 +360,6 @@ public class ZenodoAPIClient implements Serializable {
return zenodoModel.getLinks().getBucket();
}
}