Merged V2.1 to HEAD

6386: Fix for AR-1649
   6387: Fix for AR-1645
   6388: Updated Polish messages
   6389: Updated security providers
   6392: Add support to log in as guest with any password (if guest is allowed)
   6393: AR-1562 : Cannot directly exit/disable Alfresco JavaScript Debugger window
   6394: Allow creation of PropertyValue persisted properties without knowing the type QName
   6397: Log Serializable properties don't cause infinte waits
   6398: Build fix and tidy up for authentication chaining
            Resolved conflicted state of 'root\projects\repository\source\java\org\alfresco\repo\security\authentication\AuthenticationUtil.java'
   6402: AR-1643 Web Script args object does not handle multi-value arguments
   6407: Removed use of QName "{}silly" as a data type definition.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6728 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2007-09-10 15:41:43 +00:00
parent 1050a3cb98
commit a3ddf17f8e
16 changed files with 253 additions and 153 deletions

View File

@@ -24,10 +24,10 @@
*/
package org.alfresco.repo.domain;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
@@ -516,11 +516,15 @@ public class PropertyValue implements Cloneable, Serializable
}
else
{
// Convert the value to the type required. This ensures that any type conversion issues
// are caught early and prevent the scenario where the data in the DB cannot be given
// back out because it is unconvertable.
ValueType valueType = makeValueType(typeQName);
value = valueType.convert(value);
// Does the client consider the type to be important?
if (typeQName != null)
{
// Convert the value to the type required. This ensures that any type conversion issues
// are caught early and prevent the scenario where the data in the DB cannot be given
// back out because it is unconvertable.
ValueType valueType = makeValueType(typeQName);
value = valueType.convert(value);
}
// get the persisted type
ValueType persistedValueType = this.actualType.getPersistedType(value);
// convert to the persistent type
@@ -705,27 +709,41 @@ public class PropertyValue implements Cloneable, Serializable
*/
private Serializable cloneSerializable(Serializable original)
{
ObjectOutputStream objectOut = null;
ByteArrayOutputStream byteOut = null;
ObjectInputStream objectIn = null;
try
{
// Connect the pipes
PipedOutputStream pipeOut = new PipedOutputStream();
PipedInputStream pipeIn = new PipedInputStream();
pipeOut.connect(pipeIn);
// Write the object out to a byte array
byteOut = new ByteArrayOutputStream();
objectOut = new ObjectOutputStream(byteOut);
objectOut.writeObject(original);
objectOut.flush();
ObjectOutputStream objectOut = new ObjectOutputStream(pipeOut);
ObjectInputStream objectIn = new ObjectInputStream(pipeIn);
// Now write the object
objectOut.writeObject(original);
// Read the new object in
Object newObj = objectIn.readObject();
// Done
return (Serializable) newObj;
objectIn = new ObjectInputStream(new ByteArrayInputStream(byteOut.toByteArray()));
Object target = objectIn.readObject();
// Done
return (Serializable) target;
}
catch (Throwable e)
{
throw new AlfrescoRuntimeException("Failed to clone serializable object: " + original, e);
}
finally
{
if (objectOut != null)
{
try { objectOut.close(); } catch (Throwable e) {}
}
if (byteOut != null)
{
try { byteOut.close(); } catch (Throwable e) {}
}
if (objectIn != null)
{
try { objectIn.close(); } catch (Throwable e) {}
}
}
}
/**