doThrow(new ContentIOException()).when(StubbedObject).putContent(contentStream);
Throwable cause = cioe.getCause(); if (cause instanceof AccessDeniedException)
/** * Writes the content of incoming message into Alfresco repository. * * @throws MessagingException */ private void writeContent() throws MessagingException { ContentWriter writer = serviceRegistry.getContentService().getWriter(messageFileInfo.getNodeRef(), ContentModel.PROP_CONTENT, true); writer.setMimetype(MimetypeMap.MIMETYPE_RFC822); try { OutputStream outputStream = writer.getContentOutputStream(); wrappedMessage.writeTo(outputStream); outputStream.close(); wrappedMessage = null; // it is not used any more and it is available to GC (to avoid memory leak with byte[] MimeMessage.content field) this.contentReader = serviceRegistry.getContentService().getReader(messageFileInfo.getNodeRef(), ContentModel.PROP_CONTENT); } catch (ContentIOException e) { throw new MessagingException(e.getMessage(), e); } catch (IOException e) { throw new MessagingException(e.getMessage(), e); } }
Throwable cause = cioe.getCause(); if (cause instanceof AccessDeniedException)
/** * Writes the content of incoming message into Alfresco repository. * * @throws MessagingException */ private void writeContent() throws MessagingException { ContentWriter writer = serviceRegistry.getContentService().getWriter(messageFileInfo.getNodeRef(), ContentModel.PROP_CONTENT, true); writer.setMimetype(MimetypeMap.MIMETYPE_RFC822); try { OutputStream outputStream = writer.getContentOutputStream(); wrappedMessage.writeTo(outputStream); outputStream.close(); wrappedMessage = null; // it is not used any more and it is available to GC (to avoid memory leak with byte[] MimeMessage.content field) this.contentReader = serviceRegistry.getContentService().getReader(messageFileInfo.getNodeRef(), ContentModel.PROP_CONTENT); } catch (ContentIOException e) { throw new MessagingException(e.getMessage(), e); } catch (IOException e) { throw new MessagingException(e.getMessage(), e); } }
public void contentStreamClosed() throws ContentIOException { try { channel.close(); } catch (IOException e) { throw new ContentIOException("Failed to close underlying channel", e); } } };
assertTrue((TimeoutException.class.getName() + " exception is expected as the cause of transformation failure"), e.getCause() instanceof TimeoutException);
public void contentStreamClosed() throws ContentIOException { try { channel.close(); } catch (IOException e) { throw new ContentIOException("Failed to close underlying channel", e); } } };
public Void execute() throws Throwable { try { connector.appendContent(info, contentStream, isLastChunk); } catch(IOException e) { throw new ContentIOException("", e); } return null; } }, false, true);
public Void execute() throws Throwable { try { connector.appendContent(info, contentStream, isLastChunk); } catch(IOException e) { throw new ContentIOException("", e); } return null; } }, false, true);
/** * Private: for Spring-constructed instances only. * * @param rootDirectory * the root under which files will be stored. The directory will be created if it does not exist. */ private FileContentStore(File rootDirectory) { if (!rootDirectory.exists()) { if (!rootDirectory.mkdirs()) { throw new ContentIOException("Failed to create store root: " + rootDirectory, null); } } this.rootDirectory = rootDirectory.getAbsoluteFile(); rootAbsolutePath = rootDirectory.getAbsolutePath(); allowRandomAccess = true; readOnly = false; }
/** * Private: for Spring-constructed instances only. * * @param rootDirectory * the root under which files will be stored. The directory will be created if it does not exist. */ private FileContentStore(File rootDirectory) { if (!rootDirectory.exists()) { if (!rootDirectory.mkdirs()) { throw new ContentIOException("Failed to create store root: " + rootDirectory, null); } } this.rootDirectory = rootDirectory.getAbsoluteFile(); rootAbsolutePath = rootDirectory.getAbsolutePath(); allowRandomAccess = true; readOnly = false; }
private void ensureFileInContentStore(File file) { String fileNormalizedAbsoultePath = FilenameUtils.normalize(file.getAbsolutePath()); String rootNormalizedAbsolutePath = FilenameUtils.normalize(rootAbsolutePath); if (!fileNormalizedAbsoultePath.startsWith(rootNormalizedAbsolutePath)) { throw new ContentIOException("Access to files outside of content store root is not allowed: " + file); } } }
private void ensureFileInContentStore(File file) { String fileNormalizedAbsoultePath = FilenameUtils.normalize(file.getAbsolutePath()); String rootNormalizedAbsolutePath = FilenameUtils.normalize(rootAbsolutePath); if (!fileNormalizedAbsoultePath.startsWith(rootNormalizedAbsolutePath)) { throw new ContentIOException("Access to files outside of content store root is not allowed: " + file); } } }
throw new ContentIOException("Failed to create directory for file storage: " + dir);
throw new ContentIOException("Failed to open file channel: " + this, e);
throw new ContentIOException("Failed to create directory for file storage: " + dir);
throw new ContentIOException("Failed to open file channel: " + this, e);