+ id.getDocId();
try {
virusScanner.scan(tempFile, name);
} catch (VirusDetectedException e) {
log.warn("File failed virus scan: {}", e.getMessage());
throw new ChunkUploadException(Status.BAD_REQUEST,
"Uploaded file did not pass virus scan");
}
HDocument document;
Optional<String> params;
params =
Optional.fromNullable(Strings.emptyToNull(uploadForm
.getAdapterParams()));
if (!params.isPresent()) {
params =
documentDAO.getAdapterParams(id.getProjectSlug(),
id.getVersionSlug(), id.getDocId());
}
try {
Resource doc =
translationFileServiceImpl.parseUpdatedAdapterDocumentFile(
tempFile.toURI(), id.getDocId(),
uploadForm.getFileType(), params);
doc.setLang(LocaleId.EN_US);
// TODO Copy Trans values
document =
documentServiceImpl.saveDocument(id.getProjectSlug(),
id.getVersionSlug(), doc,
Collections.<String> emptySet(), false);
} catch (SecurityException e) {
throw new ChunkUploadException(Status.INTERNAL_SERVER_ERROR,
e.getMessage(), e);
} catch (ZanataServiceException e) {
throw new ChunkUploadException(Status.INTERNAL_SERVER_ERROR,
e.getMessage(), e);
}
String contentHash = uploadForm.getHash();
DocumentType documentType =