mirror of
https://github.com/Alfresco/alfresco-transform-core.git
synced 2025-08-14 17:58:27 +00:00
ATS-175 : Replace HTTP numeric codes with constants
This commit is contained in:
@@ -16,6 +16,7 @@ import static org.alfresco.transformer.fs.FileManager.createSourceFile;
|
||||
import static org.alfresco.transformer.fs.FileManager.createTargetFile;
|
||||
import static org.alfresco.transformer.fs.FileManager.createTargetFileName;
|
||||
import static org.alfresco.transformer.logging.StandardMessages.ENTERPRISE_LICENCE;
|
||||
import static org.springframework.http.HttpStatus.OK;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
@@ -120,7 +121,7 @@ public class LibreOfficeController extends AbstractTransformerController
|
||||
|
||||
final ResponseEntity<Resource> body = createAttachment(targetFilename, targetFile);
|
||||
LogEntry.setTargetSize(targetFile.length());
|
||||
long time = LogEntry.setStatusCodeAndMessage(200, "Success");
|
||||
long time = LogEntry.setStatusCodeAndMessage(OK.value(), "Success");
|
||||
time += LogEntry.addDelay(testDelay);
|
||||
getProbeTestTransform().recordTransformTime(time);
|
||||
return body;
|
||||
|
@@ -1,5 +1,8 @@
|
||||
package org.alfresco.transformer.executors;
|
||||
|
||||
import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
||||
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
@@ -62,9 +65,10 @@ public class LibreOfficeJavaExecutor implements JavaExecutor
|
||||
}
|
||||
catch (OfficeException e)
|
||||
{
|
||||
throw new TransformException(400, "LibreOffice server conversion failed: \n" +
|
||||
" from file: " + sourceFile + "\n" +
|
||||
" to file: " + targetFile, e);
|
||||
throw new TransformException(BAD_REQUEST.value(),
|
||||
"LibreOffice server conversion failed: \n" +
|
||||
" from file: " + sourceFile + "\n" +
|
||||
" to file: " + targetFile, e);
|
||||
}
|
||||
catch (Throwable throwable)
|
||||
{
|
||||
@@ -86,7 +90,8 @@ public class LibreOfficeJavaExecutor implements JavaExecutor
|
||||
|
||||
if (!targetFile.exists() || targetFile.length() == 0L)
|
||||
{
|
||||
throw new TransformException(500, "Transformer failed to create an output file");
|
||||
throw new TransformException(INTERNAL_SERVER_ERROR.value(),
|
||||
"Transformer failed to create an output file");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,7 +125,8 @@ public class LibreOfficeJavaExecutor implements JavaExecutor
|
||||
}
|
||||
catch (IOException iox)
|
||||
{
|
||||
throw new TransformException(500, "Error creating empty PDF file", iox);
|
||||
throw new TransformException(INTERNAL_SERVER_ERROR.value(),
|
||||
"Error creating empty PDF file", iox);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user