Edit 1: according to many resources the file is locked if not closed explicit until the next garbage collection. So it would be better if community commons closes all streams.
You test this by replacing the function duplicateFileDocument with this in the misc.java
public static Boolean duplicateFileDocument(IContext context, IMendixObject toClone, IMendixObject target) throws Exception
{
if (toClone == null || target == null)
throw new Exception("No file to clone or to clone into provided");
MendixBoolean hasContents = (MendixBoolean) toClone.getMember(context, FileDocument.MemberNames.HasContents.toString());
if (!hasContents.getValue(context))
return false;
InputStream inputStream = Core.getFileDocumentContent(context, toClone);
try {
Core.storeFileDocumentContent(context, target, (String) toClone.getValue(context, system.proxies.FileDocument.MemberNames.Name.toString()), inputStream);
} finally {
inputStream.close();
}
return true;
}
I was in the end able to test this and indeed seems to be in the inputstream.close. I'll file a ticket.