ModeShape/modeshape — pull request #795 by hchiorean (2013-04-18 12:14:19+00:00)
Title: MODE-1853 - Updated the code so that "unwrap" is called in more "key" places, trying to avoid the risk of Document & Array editors being passed in.

The following places have been changed, to make sure "unwrapped" values are always used:

(1) ```BasicDocument```'s and ```BasicArray```'s ```clone``` and ```with``` methods. These methods are called from ```SchematicEntryLiteral``` whenever a copy of the document is placed in the transaction table and when ```DocumentTranslator``` changes documents during ```save```.
(2) ```JcrRepository#applyChanges``` - this is the method that's being called whenever a repository configuration is being updated. The AS7 services, for example, make heavy use of this method. The idea here is that whenever a new ```RepositoryConfiguration``` is created, it shouldn't have any editors passed in.
(3) ```SchematicEntryLiteral#setContent``` - this is called from a variety of places, but if an editor is passed to this method, it should always unwrap it first.

With the above changes (and more specifically #2), the problem identified while running the ```FederationIntegrationTest``` has been fixed, in what seems to be a more correct fashion.