private void strictMimetypeCheck(ContentReader reader, TransformationOptions options, String sourceMimetype) throws UnsupportedTransformationException { if (strictMimeTypeCheck && depth.get() == 1) { String differentType = getMimetypeService().getMimetypeIfNotMatches(reader.getReader()); if (!transformerConfig.strictMimetypeCheck(sourceMimetype, differentType)) { String fileName = transformerDebug.getFileName(options, true, 0); String readerSourceMimetype = reader.getMimetype(); String message = "Transformation of ("+fileName+ ") has not taken place because the declared mimetype ("+ readerSourceMimetype+") does not match the detected mimetype ("+ differentType+")."; logger.warn(message); throw new UnsupportedTransformationException(message); } } }
private void strictMimetypeCheck(ContentReader reader, TransformationOptions options, String sourceMimetype) throws UnsupportedTransformationException { if (strictMimeTypeCheck && depth.get() == 1) { String differentType = getMimetypeService().getMimetypeIfNotMatches(reader.getReader()); if (!transformerConfig.strictMimetypeCheck(sourceMimetype, differentType)) { String fileName = transformerDebug.getFileName(options, true, 0); String readerSourceMimetype = reader.getMimetype(); String message = "Transformation of ("+fileName+ ") has not taken place because the declared mimetype ("+ readerSourceMimetype+") does not match the detected mimetype ("+ differentType+")."; logger.warn(message); throw new UnsupportedTransformationException(message); } } }
differentType = mimetypeService.getMimetypeIfNotMatches(writer.getReader());
differentType = mimetypeService.getMimetypeIfNotMatches(writer.getReader());
if(mimetypeService != null) differentType = mimetypeService.getMimetypeIfNotMatches(reader.getReader());
if(mimetypeService != null) differentType = mimetypeService.getMimetypeIfNotMatches(reader.getReader());
public void testTypeAliasesMatch() throws Exception { File testFile = AbstractContentTransformerTest.loadNamedQuickTestFile("quick.xml"); ContentReader sourceReader = new FileContentReader(testFile); sourceReader.setMimetype(MimetypeMap.MIMETYPE_XML); // "text/xml" // Detected mimetype is "application/xml" assertNull(mimetypeService.getMimetypeIfNotMatches(sourceReader)); testFile = AbstractContentTransformerTest.loadNamedQuickTestFile("quick.bmp"); sourceReader = new FileContentReader(testFile); sourceReader.setMimetype("image/bmp"); // Detected mimetype is "image/x-ms-bmp" assertNull(mimetypeService.getMimetypeIfNotMatches(sourceReader)); }
String differentType = getMimetypeService().getMimetypeIfNotMatches(reader.getReader());
String differentType = getMimetypeService().getMimetypeIfNotMatches(reader.getReader());
ContentReader contentReader = AuthenticationUtil.runAs(createTargetWork, AuthenticationUtil.getSystemUserName()); contentReader.setMimetype(declaredMimetype); String actualDetectedMimetype = mimetypeService.getMimetypeIfNotMatches(contentReader); if (actualDetectedMimetype != null)