AnsweredAssumed Answered

Can't save big files on repository using contentWriter.putContent

Question asked by eradan on Oct 6, 2015
Latest reply on Oct 7, 2015 by eradan
Hello,

I've this piece of code like this in a custom JavaService (simplified in order to get to the point):



public class CatalogManager extends BaseScopableProcessorExtension {

….

public void saveFileOnRepositoty(String fileName, File zipfile) {
   File zipfile = File.createTempFile(fileName, ".zip");
   …
   InputStream in = null;
   ScriptNode node = null;
   try {
      in = new FileInputStream(zipfile);
      node = parentDir.createFile(fileName + ".zip");;
      ContentWriter contentWriter = contentService.getWriter(node.getNodeRef(), ContentModel.PROP_CONTENT, true);
      contentWriter.putContent(in);
   } catch (Exception e) {
      throw new RuntimeException(e);
   } finally {
      IOUtils.closeQuietly(in);
   }
   
   String nodeRefResult = "";
   if (node != null) {
      nodeRefResult = node.getNodeRef().toString();
   }
   return nodeRefResult;
}

….

}


It works most of the time but if the zipfile is too big (say 100MB) it doesn't.

I've no error on log and no exception occurs.

The method correctly returns.
Logging the returning "nodeRefResult" variable and using the node browser in order to search the node itself it says that there is no such node in the workspace.

The search returns something like this:

Search failed due to: org.alfresco.error.AlfrescoRuntimeException: 09060020 Node workspace://SpacesStore/a2ee9154-a4a0-4aba-a873-f1ae303428a4 does not exist.   

Any idea?

Ivan


Outcomes