mirror of
https://github.com/Alfresco/alfresco-transform-core.git
synced 2025-05-26 17:24:47 +00:00
Add the size to the "No transforms" message as it is used in selecting them.
Example: No transforms for: text/plain (5.4 KB) -> application/pdf language=French
This commit is contained in:
parent
e6dd44fc15
commit
4805ccee31
@ -195,9 +195,12 @@ abstract class ProcessHandler extends FragmentHandler
|
|||||||
if (transformerName == null)
|
if (transformerName == null)
|
||||||
{
|
{
|
||||||
throw new TransformException(BAD_REQUEST, "No transforms for: "+
|
throw new TransformException(BAD_REQUEST, "No transforms for: "+
|
||||||
sourceMimetype+" -> "+targetMimetype+transformOptions.entrySet().stream()
|
sourceMimetype+
|
||||||
.map(entry -> entry.getKey()+"="+entry.getValue())
|
(sourceSizeInBytes >= 0 ? " ("+TransformerDebug.fileSize(sourceSizeInBytes)+")" : "")+
|
||||||
.collect(Collectors.joining(", ", " ", "")));
|
" -> "+targetMimetype+
|
||||||
|
transformOptions.entrySet().stream()
|
||||||
|
.map(entry -> entry.getKey()+"="+entry.getValue())
|
||||||
|
.collect(Collectors.joining(", ", " ", "")));
|
||||||
}
|
}
|
||||||
return transformerName;
|
return transformerName;
|
||||||
}
|
}
|
||||||
|
@ -477,6 +477,6 @@ public class TransformControllerTest
|
|||||||
.param("unknown", "1"))
|
.param("unknown", "1"))
|
||||||
.andExpect(status().isBadRequest())
|
.andExpect(status().isBadRequest())
|
||||||
.andExpect(content().string(containsString("TwoCustomTransformers Error Page")))
|
.andExpect(content().string(containsString("TwoCustomTransformers Error Page")))
|
||||||
.andExpect(content().string(containsString("No transforms for:")));
|
.andExpect(content().string(containsString("No transforms for: text/plain (5 bytes) -> application/pdf unknown=1")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -322,7 +322,7 @@ public class TransformerDebug
|
|||||||
return String.format("%,d ms", time);
|
return String.format("%,d ms", time);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String fileSize(long size)
|
public static String fileSize(long size)
|
||||||
{
|
{
|
||||||
if (size < 0)
|
if (size < 0)
|
||||||
{
|
{
|
||||||
@ -346,7 +346,7 @@ public class TransformerDebug
|
|||||||
return fileSizeFormat(size, divider, units[units.length-1]);
|
return fileSizeFormat(size, divider, units[units.length-1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String fileSizeFormat(long size, long divider, String unit)
|
private static String fileSizeFormat(long size, long divider, String unit)
|
||||||
{
|
{
|
||||||
size = size * 10 / divider;
|
size = size * 10 / divider;
|
||||||
int decimalPoint = (int) size % 10;
|
int decimalPoint = (int) size % 10;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user