Source:
<code>public List<BinaryContent> transform( List<Metacard> metacards, MimeType mimeType, String transformerId, Map<String, Serializable> transformerArguments) throws CatalogTransformerException { if (CollectionUtils.isEmpty(metacards)) { throw new IllegalArgumentException("Metacards list is empty."); } List<MultiMetacardTransformer> multiMetacardTransformers = StringUtils.isNotEmpty(transformerId) ? transformerLocator.findMultiMetacardTransformers(transformerId) : transformerLocator.findMultiMetacardTransformers(mimeType); LOGGER.trace( "List of matches for mimeType and transformerId [{}]: {}", mimeType, transformerId, multiMetacardTransformers); if (CollectionUtils.isEmpty(multiMetacardTransformers)) { throw new IllegalArgumentException("Transformer " + transformerId + " not found"); } List<String> stackTraceList = new ArrayList<>(); List<BinaryContent> binaryContents = null; for (MultiMetacardTransformer transformer : multiMetacardTransformers) { try { binaryContents = transformer.transform(metacards, transformerArguments); } catch (CatalogTransformerException e) { List<String> stackTraces = Arrays.asList(ExceptionUtils.getRootCauseStackTrace(e)); stackTraceList.add( String.format("Transformer [%s] could not transform metacard.", transformer)); stackTraceList.addAll(stackTraces); LOGGER.debug("Transformer could not transform metacard.", transformer, e); } } if (CollectionUtils.isEmpty(binaryContents)) { throw new CatalogTransformerException( <START> String.format( <END> "Could not transform metacards: transformerId=%s : %s", transformerId, StringUtils.join(stackTraceList, "\n"))); } return binaryContents; }</code><technical_language>Do need a if (binaryContents != null) break; here</technical_language>

Target:
public List<BinaryContent> transform( List<Metacard> metacards, MimeType mimeType, String transformerId, Map<String, Serializable> transformerArguments) throws CatalogTransformerException { if (CollectionUtils.isEmpty(metacards)) { throw new IllegalArgumentException("Metacards list is empty."); } List<MultiMetacardTransformer> multiMetacardTransformers = StringUtils.isNotEmpty(transformerId) ? transformerLocator.findMultiMetacardTransformers(transformerId) : transformerLocator.findMultiMetacardTransformers(mimeType); LOGGER.trace( "List of matches for mimeType and transformerId [{}]: {}", mimeType, transformerId, multiMetacardTransformers); if (CollectionUtils.isEmpty(multiMetacardTransformers)) { throw new IllegalArgumentException( String.format( "Transformer not found for transformerId=%s or mime-type=%s.", getSafeTransformerId(transformerId), mimeType)); } List<String> stackTraceList = new ArrayList<>(); List<BinaryContent> binaryContents = null; for (MultiMetacardTransformer transformer : multiMetacardTransformers) { binaryContents = attemptTransform(metacards, transformerArguments, stackTraceList, transformer); if (CollectionUtils.isNotEmpty(binaryContents)) { break; } } if (CollectionUtils.isEmpty(binaryContents)) { throw new CatalogTransformerException( String.format( "Could not transform metacards: transformerId=%s : %s", getSafeTransformerId(transformerId), StringUtils.join(stackTraceList, "\n"))); } return binaryContents; }