mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-15 15:02:20 +00:00
Merged V4.1-BUG-FIX (4.1.5) to HEAD (4.2)
47769: Merged V4.1.4 (4.1.4) to V4.1-BUG-FIX (4.1.5) 47768: ALF-17444 transformation of Outlook files (.msg) doesn't work ootb - Downgrade ERROR to debug - Complex transformer correctly checks all transformations between intermediate mimetypes. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@47773 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -41,6 +41,7 @@ import org.alfresco.repo.content.transform.ContentTransformer;
|
|||||||
import org.alfresco.repo.content.transform.ContentTransformerRegistry;
|
import org.alfresco.repo.content.transform.ContentTransformerRegistry;
|
||||||
import org.alfresco.repo.content.transform.TransformerDebug;
|
import org.alfresco.repo.content.transform.TransformerDebug;
|
||||||
import org.alfresco.repo.content.transform.UnimportantTransformException;
|
import org.alfresco.repo.content.transform.UnimportantTransformException;
|
||||||
|
import org.alfresco.repo.content.transform.UnsupportedTransformationException;
|
||||||
import org.alfresco.repo.node.NodeServicePolicies;
|
import org.alfresco.repo.node.NodeServicePolicies;
|
||||||
import org.alfresco.repo.policy.ClassPolicyDelegate;
|
import org.alfresco.repo.policy.ClassPolicyDelegate;
|
||||||
import org.alfresco.repo.policy.JavaBehaviour;
|
import org.alfresco.repo.policy.JavaBehaviour;
|
||||||
@@ -722,19 +723,21 @@ public class ContentServiceImpl implements ContentService, ApplicationContextAwa
|
|||||||
if (done)
|
if (done)
|
||||||
{
|
{
|
||||||
message = "Transformer succeeded after previous transformer failed"+ (message == null ? "" : ": "+message);
|
message = "Transformer succeeded after previous transformer failed"+ (message == null ? "" : ": "+message);
|
||||||
if (rootCause instanceof UnimportantTransformException)
|
if (rootCause instanceof UnsupportedTransformationException ||
|
||||||
|
rootCause instanceof UnimportantTransformException)
|
||||||
{
|
{
|
||||||
logger.debug(message);
|
logger.debug(message);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
logger.error(message, e);
|
logger.warn(message, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!first) // The first exception is logged later
|
else if (!first) // The first exception is logged later
|
||||||
{
|
{
|
||||||
message = "Transformer exception"+ (message == null ? "" : ": "+message);
|
message = "Transformer exception"+ (message == null ? "" : ": "+message);
|
||||||
if (rootCause instanceof UnimportantTransformException)
|
if (rootCause instanceof UnsupportedTransformationException ||
|
||||||
|
rootCause instanceof UnimportantTransformException)
|
||||||
{
|
{
|
||||||
logger.debug(message);
|
logger.debug(message);
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2005-2012 Alfresco Software Limited.
|
* Copyright (C) 2005-2013 Alfresco Software Limited.
|
||||||
*
|
*
|
||||||
* This file is part of Alfresco
|
* This file is part of Alfresco
|
||||||
*
|
*
|
||||||
@@ -121,9 +121,16 @@ public abstract class AbstractContentTransformer2 extends AbstractContentTransfo
|
|||||||
boolean transformable = isTransformable(sourceMimetype, sourceSize, targetMimetype, options);
|
boolean transformable = isTransformable(sourceMimetype, sourceSize, targetMimetype, options);
|
||||||
if (transformable == false)
|
if (transformable == false)
|
||||||
{
|
{
|
||||||
AlfrescoRuntimeException e = new AlfrescoRuntimeException("Unsuported transformation attempted: \n" +
|
// This method is only called once a transformer has been selected, so it should be able to
|
||||||
" reader: " + reader + "\n" +
|
// handle the mimetypes but might not be able to handle all the limits as it might be part of
|
||||||
" writer: " + writer);
|
// of a complex (compound) transformer. So report the max size if set.
|
||||||
|
long maxSourceSizeKBytes = getMaxSourceSizeKBytes(sourceMimetype, targetMimetype, options);
|
||||||
|
boolean sizeOkay = maxSourceSizeKBytes < 0 || (maxSourceSizeKBytes > 0 && sourceSize <= maxSourceSizeKBytes*1024);
|
||||||
|
AlfrescoRuntimeException e = new UnsupportedTransformationException("Unsupported transformation: " +
|
||||||
|
getBeanName()+' '+sourceMimetype+" to "+targetMimetype+' '+
|
||||||
|
(sizeOkay
|
||||||
|
? ""
|
||||||
|
: transformerDebug.fileSize(sourceSize)+" > "+ transformerDebug.fileSize(maxSourceSizeKBytes)));
|
||||||
throw transformerDebug.setCause(e);
|
throw transformerDebug.setCause(e);
|
||||||
}
|
}
|
||||||
// it all checks out OK
|
// it all checks out OK
|
||||||
@@ -209,6 +216,12 @@ public abstract class AbstractContentTransformer2 extends AbstractContentTransfo
|
|||||||
// We rethrow the exception
|
// We rethrow the exception
|
||||||
throw cste;
|
throw cste;
|
||||||
}
|
}
|
||||||
|
catch (UnsupportedTransformationException e)
|
||||||
|
{
|
||||||
|
// Don't record an error or even the time, as this is normal in compound transformations.
|
||||||
|
transformerDebug.debug(" Failed", e);
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
catch (Throwable e)
|
catch (Throwable e)
|
||||||
{
|
{
|
||||||
// Make sure that this transformation gets set back i.t.o. time taken.
|
// Make sure that this transformation gets set back i.t.o. time taken.
|
||||||
|
@@ -760,7 +760,7 @@ public class TransformerDebug
|
|||||||
}
|
}
|
||||||
if (frame != null)
|
if (frame != null)
|
||||||
{
|
{
|
||||||
sb.append(spaces(11-sb.length()+lengthOfFirstId)); // Try to pad to level 7
|
sb.append(spaces(13-sb.length()+lengthOfFirstId)); // Try to pad to level 7
|
||||||
}
|
}
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2013 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This file is part of Alfresco
|
||||||
|
*
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.alfresco.repo.content.transform;
|
||||||
|
|
||||||
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exception indicates that a transformer is unable to transform a requested
|
||||||
|
* transformation. Normally the transformer is a component of a complex (compound) transformer
|
||||||
|
* and has been asked to transform a file that is too large (see transformation limits) as the
|
||||||
|
* size of the intermediate file is unknown at the start.
|
||||||
|
*
|
||||||
|
* @author Alan Davis
|
||||||
|
*/
|
||||||
|
public class UnsupportedTransformationException extends AlfrescoRuntimeException
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 9039331287661301086L;
|
||||||
|
|
||||||
|
public UnsupportedTransformationException(String msgId)
|
||||||
|
{
|
||||||
|
super(msgId);
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user