return buffer; } catch (final ContentNotFoundException cnfe) { throw new ContentNotFoundException(currentFlowFile, cnfe.getMissingClaim(), cnfe.getMessage());
private void handleContentNotFound(final ContentNotFoundException nfe, final StandardRepositoryRecord suspectRecord) { final ContentClaim registeredClaim = suspectRecord.getOriginalClaim(); final ContentClaim transientClaim = suspectRecord.getWorkingClaim(); final ContentClaim missingClaim = nfe.getMissingClaim(); final ProvenanceEventRecord dropEvent = provenanceReporter.drop(suspectRecord.getCurrent(), nfe.getMessage() == null ? "Content Not Found" : nfe.getMessage()); if (dropEvent != null) { context.getProvenanceRepository().registerEvent(dropEvent); } if (missingClaim == registeredClaim) { suspectRecord.markForAbort(); rollback(); throw new MissingFlowFileException("Unable to find content for FlowFile", nfe); } if (missingClaim == transientClaim) { rollback(); throw new MissingFlowFileException("Unable to find content for FlowFile", nfe); } }
rawIn = contentRepository.read(flowFile.getContentClaim()); } catch (final ContentNotFoundException cnfe) { throw new ContentNotFoundException(flowFile, flowFile.getContentClaim(), cnfe.getMessage()); StreamUtils.skip(rawIn, flowFile.getContentClaimOffset()); } catch (final EOFException eof) { throw new ContentNotFoundException(flowFile, flowFile.getContentClaim(), "FlowFile has a Content Claim Offset of " + flowFile.getContentClaimOffset() + " bytes but the Content Claim does not have that many bytes");
private ContentBlock getContent(final ContentClaim claim) throws ContentNotFoundException { final ContentBlock content = claimMap.get(claim); if (content == null) { throw new ContentNotFoundException(claim); } return content; }
final Optional<FlowFileRecord> optionalFlowFile = ((ContentNotFoundException) cause).getFlowFile(); if (optionalFlowFile.isPresent()) { final List<FlowFileRecord> successfulFlowFiles = new ArrayList<>(flowFiles);
private void ensureAllContentRead() throws ContentNotFoundException { if (bytesConsumed < flowFile.getSize()) { thrown = new ContentNotFoundException(claim, "Stream contained only " + bytesConsumed + " bytes but should have contained " + flowFile.getSize()); throw thrown; } }
private Path getPath(final ContentClaim claim, final boolean verifyExists) throws ContentNotFoundException { final ResourceClaim resourceClaim = claim.getResourceClaim(); final Path containerPath = containers.get(resourceClaim.getContainer()); if (containerPath == null) { if (verifyExists) { throw new ContentNotFoundException(claim); } else { return null; } } // Create the Path that points to the data Path resolvedPath = containerPath.resolve(resourceClaim.getSection()).resolve(resourceClaim.getId()); // If the data does not exist, create a Path that points to where the data would exist in the archive directory. if (!Files.exists(resolvedPath)) { resolvedPath = getArchivePath(claim.getResourceClaim()); if (verifyExists && !Files.exists(resolvedPath)) { throw new ContentNotFoundException(claim); } } return resolvedPath; }
throw cnfe; } catch (final EOFException eof) { throw new ContentNotFoundException(claim, eof); } catch (final IOException ioe) { throw new FlowFileAccessException("Failed to read content of " + flowFile, ioe);