mirror of
https://github.com/Alfresco/alfresco-transform-core.git
synced 2025-07-31 17:38:33 +00:00
Revert "Revert "Revert "ATS-702/ATS-675 Change exception thrown by tranformers to TransformException"""
This reverts commit 3245dcc151
.
This commit is contained in:
@@ -174,8 +174,19 @@ public class AIOController extends AbstractTransformerController
|
||||
debugLogTransform("Performing transform with parameters: ", sourceMimetype, targetMimetype,
|
||||
targetExtension, requestParameters);
|
||||
|
||||
transformer.transform(sourceFile, targetFile, sourceMimetype, targetMimetype, transformOptions);
|
||||
|
||||
try
|
||||
{
|
||||
transformer.transform(sourceFile, targetFile, sourceMimetype, targetMimetype, transformOptions);
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
{
|
||||
throw new TransformException(BAD_REQUEST.value(), e.getMessage(), e);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new TransformException(INTERNAL_SERVER_ERROR.value(), e.getMessage(), e);
|
||||
}
|
||||
|
||||
final ResponseEntity<Resource> body = createAttachment(targetFilename, targetFile);
|
||||
LogEntry.setTargetSize(targetFile.length());
|
||||
long time = LogEntry.setStatusCodeAndMessage(OK.value(), "Success");
|
||||
|
@@ -26,11 +26,8 @@
|
||||
*/
|
||||
package org.alfresco.transformer.transformers;
|
||||
|
||||
import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
||||
|
||||
import org.alfresco.transform.client.model.config.TransformConfig;
|
||||
import org.alfresco.transform.client.model.config.TransformOption;
|
||||
import org.alfresco.transform.exceptions.TransformException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -83,14 +80,14 @@ public class AllInOneTransformer implements Transformer
|
||||
|
||||
@Override
|
||||
public void transform(File sourceFile, File targetFile, String sourceMimetype, String targetMimetype,
|
||||
Map<String, String> transformOptions) throws TransformException
|
||||
Map<String, String> transformOptions) throws Exception
|
||||
{
|
||||
String transformName = transformOptions.get(TRANSFORM_NAME_PARAMETER);
|
||||
Transformer transformer = transformerTransformMapping.get(transformName);
|
||||
|
||||
if (transformer == null)
|
||||
{
|
||||
throw new TransformException(BAD_REQUEST.value(),"No transformer mapping for : transform:" + transformName + " sourceMimetype:"
|
||||
throw new Exception("No transformer mapping for : transform:" + transformName + " sourceMimetype:"
|
||||
+ sourceMimetype + " targetMimetype:" + targetMimetype);
|
||||
}
|
||||
|
||||
|
@@ -50,7 +50,6 @@ import static org.alfresco.transformer.util.Util.stringToLong;
|
||||
import java.io.File;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.transform.exceptions.TransformException;
|
||||
import org.alfresco.transformer.ImageMagickOptionsBuilder;
|
||||
import org.alfresco.transformer.executors.ImageMagickCommandExecutor;
|
||||
|
||||
@@ -74,7 +73,7 @@ public class ImageMagickAdapter extends AbstractTransformer
|
||||
|
||||
@Override
|
||||
public void transform(File sourceFile, File targetFile, String sourceMimetype, String targetMimetype,
|
||||
Map<String, String> transformOptions) throws TransformException
|
||||
Map<String, String> transformOptions) throws Exception
|
||||
{
|
||||
|
||||
final String options = ImageMagickOptionsBuilder
|
||||
|
@@ -29,7 +29,6 @@ package org.alfresco.transformer.transformers;
|
||||
import java.io.File;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.transform.exceptions.TransformException;
|
||||
import org.alfresco.transformer.executors.LibreOfficeJavaExecutor;
|
||||
|
||||
public class LibreOfficeAdapter extends AbstractTransformer
|
||||
@@ -51,7 +50,7 @@ public class LibreOfficeAdapter extends AbstractTransformer
|
||||
|
||||
@Override
|
||||
public void transform(File sourceFile, File targetFile, String sourceMimetype, String targetMimetype,
|
||||
Map<String, String> transformOptions) throws TransformException
|
||||
Map<String, String> transformOptions) throws Exception
|
||||
{
|
||||
javaExecutor.call(sourceFile, targetFile);
|
||||
}
|
||||
|
@@ -29,8 +29,6 @@ package org.alfresco.transformer.transformers;
|
||||
import java.io.File;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.transform.exceptions.TransformException;
|
||||
|
||||
public class MiscAdapter extends AbstractTransformer
|
||||
{
|
||||
private static final String CONFIG_PREFIX = "misc";
|
||||
@@ -50,8 +48,8 @@ public class MiscAdapter extends AbstractTransformer
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transform(File sourceFile, File targetFile, String sourceMimetype, String targetMimetype,
|
||||
Map<String,String> transformOptions) throws TransformException
|
||||
public void transform(File sourceFile, File targetFile, String sourceMimetype, String targetMimetype, Map<String,
|
||||
String> transformOptions) throws Exception
|
||||
{
|
||||
String transformerName = transformOptions.get(TRANSFORM_NAME_PARAMETER);
|
||||
miscSelectingTransformer.transform(transformerName, sourceFile, targetFile,
|
||||
|
@@ -38,7 +38,6 @@ import java.io.File;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.transformer.executors.PdfRendererCommandExecutor;
|
||||
import org.alfresco.transform.exceptions.TransformException;
|
||||
import org.alfresco.transformer.PdfRendererOptionsBuilder;
|
||||
|
||||
|
||||
@@ -60,8 +59,8 @@ public class PdfRendererAdapter extends AbstractTransformer
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transform(File sourceFile, File targetFile, String sourceMimetype, String targetMimetype,
|
||||
Map<String, String> transformOptions) throws TransformException
|
||||
public void transform(File sourceFile, File targetFile, String sourceMimetype, String targetMimetype,
|
||||
Map<String, String> transformOptions) throws Exception
|
||||
{
|
||||
|
||||
final String options = PdfRendererOptionsBuilder
|
||||
|
@@ -26,7 +26,6 @@
|
||||
*/
|
||||
package org.alfresco.transformer.transformers;
|
||||
|
||||
import org.alfresco.transform.exceptions.TransformException;
|
||||
import org.alfresco.transformer.executors.TikaJavaExecutor;
|
||||
|
||||
import java.io.File;
|
||||
@@ -56,8 +55,7 @@ public class TikaAdapter extends AbstractTransformer
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transform(File sourceFile, File targetFile, String sourceMimetype, String targetMimetype,
|
||||
Map<String, String> transformOptions) throws TransformException
|
||||
public void transform(File sourceFile, File targetFile, String sourceMimetype, String targetMimetype, Map<String, String> transformOptions) throws Exception
|
||||
{
|
||||
final String transform = transformOptions.get(TRANSFORM_NAME_PARAMETER);
|
||||
|
||||
|
@@ -28,7 +28,6 @@ package org.alfresco.transformer.transformers;
|
||||
|
||||
|
||||
import org.alfresco.transform.client.model.config.TransformConfig;
|
||||
import org.alfresco.transform.exceptions.TransformException;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Map;
|
||||
@@ -50,10 +49,10 @@ public interface Transformer
|
||||
* @param sourceFile
|
||||
* @param targetFile
|
||||
* @param transformOptions
|
||||
* @throws TransformException - if there was a problem internally
|
||||
* @throws Exception
|
||||
*/
|
||||
void transform(File sourceFile, File targetFile, String sourceMimetype,
|
||||
String targetMimetype, Map<String, String> transformOptions) throws TransformException;
|
||||
String targetMimetype, Map<String, String> transformOptions) throws Exception;
|
||||
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user