SUPPORT-8507: unused methode and parameter are removed
This commit is contained in:
parent
280f6b55a0
commit
b866c02537
3 changed files with 1 additions and 33 deletions
|
|
@ -15,7 +15,6 @@ import org.apache.http.client.methods.CloseableHttpResponse;
|
|||
import org.apache.http.client.methods.HttpDelete;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.client.methods.HttpPut;
|
||||
import org.apache.http.conn.HttpHostConnectException;
|
||||
import org.apache.http.entity.mime.MultipartEntityBuilder;
|
||||
import org.apache.http.entity.mime.content.FileBody;
|
||||
|
|
@ -54,8 +53,6 @@ public class FileUploadService {
|
|||
private Long avFirstTimeoutMilliseconds;
|
||||
@Value("${file.saving.path}")
|
||||
private String fileSavingPath;
|
||||
@Value("${http.file.server.out.address:http://localhost/out}")
|
||||
private String httpFileServerOutAddress;
|
||||
private final KafkaTemplate<String, String> kafkaTemplate;
|
||||
private final NewTopic outErrorTopic;
|
||||
private final NewTopic outSuccessTopic;
|
||||
|
|
@ -235,35 +232,6 @@ public class FileUploadService {
|
|||
}
|
||||
}
|
||||
|
||||
private void uploadFile(String filePath, String uploadUrl) throws FileUploadException {
|
||||
File file = new File(filePath);
|
||||
|
||||
try (CloseableHttpClient client = HttpClients.createDefault()) {
|
||||
HttpPut put = new HttpPut(uploadUrl);
|
||||
HttpEntity entity = MultipartEntityBuilder.create()
|
||||
.addPart("file", new FileBody(file))
|
||||
.build();
|
||||
put.setEntity(entity);
|
||||
|
||||
try (CloseableHttpResponse response = client.execute(put)) {
|
||||
int statusCode = response.getStatusLine().getStatusCode();
|
||||
if (statusCode == HttpStatus.NO_CONTENT.value()) {
|
||||
// считаем, что происходит повторная обработка
|
||||
// этот же файл доставлен при предыдущей обработке и не удален из входного хранилища
|
||||
logger.warn("file already exists : " + uploadUrl);
|
||||
}
|
||||
else if (statusCode != HttpStatus.CREATED.value()) {
|
||||
String message = "http status code " + statusCode + " : " + uploadUrl;
|
||||
throw new RuntimeException(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
// непредусмотренная ошибка доступа через http-клиент
|
||||
throw new FileUploadException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private void deleteFile(String fileUrl) throws FileUploadException {
|
||||
try (CloseableHttpClient client = HttpClients.createDefault()) {
|
||||
HttpDelete delete = new HttpDelete(fileUrl);
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ public class ReceiveScanReportRetryable {
|
|||
}
|
||||
}
|
||||
catch (ClientProtocolException e) {
|
||||
// непредусмотренная ошибка доступа через http-клиент
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
catch (IOException e) {
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@ kafka-out.success.topic.name=${OUT_KAFKA_SUCCESS_TOPIC_NAME}
|
|||
av.rest.address=${AV_REST_ADDRESS}
|
||||
av.first.timeout.milliseconds=${AV_FIRST_TIMEOUT_MILLISECONDS}
|
||||
file.saving.path=${FILE_SAVING_PATH}
|
||||
http.file.server.out.address=${HTTP_FILE_SERVER_OUT_ADDRESS}
|
||||
#
|
||||
s3.out.endpoint=${S3_ENDPOINT}
|
||||
s3.out.port=${S3_PORT}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue