diff --git a/dil/src/main/java/org/assimbly/dil/blocks/beans/enrich/zipfile/ZipFileEnrichStrategy.java b/dil/src/main/java/org/assimbly/dil/blocks/beans/enrich/zipfile/ZipFileEnrichStrategy.java index b84c176d..778571f2 100644 --- a/dil/src/main/java/org/assimbly/dil/blocks/beans/enrich/zipfile/ZipFileEnrichStrategy.java +++ b/dil/src/main/java/org/assimbly/dil/blocks/beans/enrich/zipfile/ZipFileEnrichStrategy.java @@ -27,13 +27,18 @@ public class ZipFileEnrichStrategy implements AggregationStrategy { public Exchange aggregate(Exchange oldExchange, Exchange newExchange) { elementNames = new ArrayList<>(); + if (newExchange == null) { + // there’s no remote file to consume + return oldExchange; + } + Message in = oldExchange.getIn(); Message resource = newExchange.getIn(); byte[] sourceZip = in.getBody(byte[].class); - byte[] resourceData = resource.getBody(byte[].class); + byte[] resourceData = newExchange.getContext().getTypeConverter().convertTo(byte[].class, resource.getBody()); - String fileName = resource.getHeader(Exchange.FILE_NAME, String.class); + String fileName = resource.getHeader(Exchange.FILE_NAME_CONSUMED, String.class); ByteArrayOutputStream baos = new ByteArrayOutputStream();