mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-08 14:51:49 +00:00
Merged HEAD-BUG-FIX (5.1/Cloud) to HEAD (5.1/Cloud)
102053: Merged 5.0.N (5.0.2) to HEAD-BUG-FIX (5.1/Cloud) 101917: Merged DEV to 5.0.N (5.0.2) 101898 : MNT-13826: Activiti engine throwing NPE when changing a long String (>4000 characters) to a normal String (<4000 characters)) - Replaced deprecated methods git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@102199 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -50,23 +50,14 @@ public class CustomStringVariableType extends StringType
|
||||
{
|
||||
if(value != null && ((String) value).length() > MAX_TEXT_LENGTH)
|
||||
{
|
||||
ByteArrayEntity byteArray = valueFields.getByteArrayValue();
|
||||
byte[] bytes = ((String) value).getBytes();
|
||||
if (byteArray==null)
|
||||
{
|
||||
valueFields.setByteArrayValue(bytes);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Reuse the existing byte-array entity on an update instead of creating a new one each time
|
||||
byteArray.setBytes(bytes);
|
||||
}
|
||||
}
|
||||
valueFields.setBytes(bytes);
|
||||
}
|
||||
else {
|
||||
// Make sure NO byte-array is present anymore in case this variable exceeded the
|
||||
// length before this update, but is shorter now
|
||||
valueFields.setByteArrayValue(null);
|
||||
|
||||
valueFields.setBytes(null);
|
||||
|
||||
// Revert to storing regular string
|
||||
super.setValue(value, valueFields);
|
||||
}
|
||||
@@ -77,8 +68,8 @@ public class CustomStringVariableType extends StringType
|
||||
{
|
||||
// In case the string is stored as a byte-array, create a string from the stored bytes
|
||||
// using platform encoding and return this instead of the text-value
|
||||
if(valueFields.getByteArrayValueId() != null && valueFields.getByteArrayValue() != null) {
|
||||
return new String(valueFields.getByteArrayValue().getBytes());
|
||||
if(valueFields.getBytes() != null) {
|
||||
return new String(valueFields.getBytes());
|
||||
}
|
||||
return super.getValue(valueFields);
|
||||
}
|
||||
|
Reference in New Issue
Block a user