mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-08 14:51:49 +00:00
Merged 5.0.N (5.0.3) to 5.1.N (5.1.1)
117582 adavis: Merged V4.2-BUG-FIX (4.2.6) to 5.0.N (5.0.3) (PARTIAL MERGE) 116652 amorarasu: MNT-14983: CMIS: Euro character not encoded correctly Merged V4.2.4 (4.2.4.19) to V4.2-BUG-FIX (4.2.6) 115140 115998 116396 amorarasu: MNT-15044: CLONE - CMIS: Euro character not encoded correctly - Removed the unicode interval that was used to escape characters from the categories: currency, general punctuation, subscripts and superscripts (2000-20FF). - Changed the way the control characters are filtered + adapted tests. - Removed unnecessary j_string use from the ftl and added proper xml encoding. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.1.N/root@117597 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -2680,7 +2680,7 @@ public class AlfrescoCmisServiceImpl extends AbstractCmisService implements Alfr
|
|||||||
// general properties
|
// general properties
|
||||||
info.setObject(object);
|
info.setObject(object);
|
||||||
info.setId(object.getId());
|
info.setId(object.getId());
|
||||||
info.setName(ni.getName());
|
info.setName(getStringProperty(object, PropertyIds.NAME));
|
||||||
info.setCreatedBy(getStringProperty(object, PropertyIds.CREATED_BY));
|
info.setCreatedBy(getStringProperty(object, PropertyIds.CREATED_BY));
|
||||||
info.setCreationDate(getDateTimeProperty(object, PropertyIds.CREATION_DATE));
|
info.setCreationDate(getDateTimeProperty(object, PropertyIds.CREATION_DATE));
|
||||||
info.setLastModificationDate(getDateTimeProperty(object, PropertyIds.LAST_MODIFICATION_DATE));
|
info.setLastModificationDate(getDateTimeProperty(object, PropertyIds.LAST_MODIFICATION_DATE));
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2005-2014 Alfresco Software Limited.
|
* Copyright (C) 2005-2015 Alfresco Software Limited.
|
||||||
*
|
*
|
||||||
* This file is part of Alfresco
|
* This file is part of Alfresco
|
||||||
*
|
*
|
||||||
@@ -260,6 +260,7 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static final char ID_SEPERATOR = ';';
|
public static final char ID_SEPERATOR = ';';
|
||||||
|
public static final char REPLACEMENT_CHAR = '_';
|
||||||
public static final String ASSOC_ID_PREFIX = "assoc:";
|
public static final String ASSOC_ID_PREFIX = "assoc:";
|
||||||
public static final String PWC_VERSION_LABEL = "pwc";
|
public static final String PWC_VERSION_LABEL = "pwc";
|
||||||
public static final String UNVERSIONED_VERSION_LABEL = "1.0";
|
public static final String UNVERSIONED_VERSION_LABEL = "1.0";
|
||||||
@@ -2173,11 +2174,13 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
|
|||||||
return df.newXMLGregorianCalendar((GregorianCalendar) value).toXMLFormat();
|
return df.newXMLGregorianCalendar((GregorianCalendar) value).toXMLFormat();
|
||||||
}
|
}
|
||||||
|
|
||||||
// MNT-12496
|
// MNT-12496 MNT-15044
|
||||||
// Encode for AtomPub only. Browser/json binding already encodes.
|
// Filter for AtomPub and Web services bindings only. Browser/json binding already encodes.
|
||||||
if (AlfrescoCmisServiceCall.get() != null && CallContext.BINDING_ATOMPUB.equals(AlfrescoCmisServiceCall.get().getBinding()))
|
if (AlfrescoCmisServiceCall.get() != null &&
|
||||||
|
(CallContext.BINDING_ATOMPUB.equals(AlfrescoCmisServiceCall.get().getBinding()) ||
|
||||||
|
CallContext.BINDING_WEBSERVICES.equals(AlfrescoCmisServiceCall.get().getBinding())))
|
||||||
{
|
{
|
||||||
return escapeControlCharacters(value.toString());
|
return filterXmlRestrictedCharacters(value.toString());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -2277,16 +2280,18 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// MNT-12496
|
// MNT-12496 MNT-15044
|
||||||
// Encode for AtomPub only. Browser/json binding already encodes.
|
// Filter for AtomPub and Web services bindings only. Browser/json binding already encodes.
|
||||||
if (AlfrescoCmisServiceCall.get() != null && CallContext.BINDING_ATOMPUB.equals(AlfrescoCmisServiceCall.get().getBinding()))
|
if (AlfrescoCmisServiceCall.get() != null &&
|
||||||
{
|
(CallContext.BINDING_ATOMPUB.equals(AlfrescoCmisServiceCall.get().getBinding()) ||
|
||||||
((PropertyStringImpl) result).setValue(escapeControlCharacters((String) value));
|
CallContext.BINDING_WEBSERVICES.equals(AlfrescoCmisServiceCall.get().getBinding())))
|
||||||
}
|
{
|
||||||
else
|
((PropertyStringImpl) result).setValue(filterXmlRestrictedCharacters((String) value));
|
||||||
{
|
}
|
||||||
((PropertyStringImpl) result).setValue((String) value);
|
else
|
||||||
}
|
{
|
||||||
|
((PropertyStringImpl) result).setValue((String) value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case URI:
|
case URI:
|
||||||
@@ -2315,7 +2320,7 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String escapeControlCharacters(String origValue)
|
private String filterXmlRestrictedCharacters(String origValue)
|
||||||
{
|
{
|
||||||
if (origValue == null)
|
if (origValue == null)
|
||||||
{
|
{
|
||||||
@@ -2326,33 +2331,10 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
|
|||||||
for (int i = 0; i < origValue.length(); i++)
|
for (int i = 0; i < origValue.length(); i++)
|
||||||
{
|
{
|
||||||
char ch = origValue.charAt(i);
|
char ch = origValue.charAt(i);
|
||||||
switch (ch)
|
boolean restricted = (ch < '\u0020') && !(ch == '\t' || ch == '\n' || ch == '\r');
|
||||||
{
|
sb.append(restricted ? REPLACEMENT_CHAR : ch);
|
||||||
case '\b':
|
|
||||||
case '\f':
|
|
||||||
case '\n':
|
|
||||||
case '\r':
|
|
||||||
case '\t':
|
|
||||||
sb.append(ch);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
// Reference: http://www.unicode.org/versions/Unicode5.1.0/
|
|
||||||
if ((ch >= '\u0000' && ch <= '\u001F') || (ch >= '\u007F' && ch <= '\u009F') || (ch >= '\u2000' && ch <= '\u20FF'))
|
|
||||||
{
|
|
||||||
String ss = Integer.toHexString(ch);
|
|
||||||
sb.append("\\u");
|
|
||||||
for (int k = 0; k < 4 - ss.length(); k++)
|
|
||||||
{
|
|
||||||
sb.append('0');
|
|
||||||
}
|
|
||||||
sb.append(ss.toUpperCase());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sb.append(ch);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user