Source:
<code>public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) { if (transformProvider == null) { throw new ConversionException( "Unable to locate Converter for outputSchema: " + CswConstants.CSW_OUTPUT_SCHEMA); } CswRecordCollection cswRecords = new CswRecordCollection(); List<Metacard> metacards = cswRecords.getCswRecords(); XStreamAttributeCopier.copyXmlNamespaceDeclarationsIntoContext(reader, context); while (reader.hasMoreChildren()) { reader.moveDown(); if (reader.getNodeName().contains("SearchResults")) { setSearchResults(reader, cswRecords); while (reader.hasMoreChildren()) { reader.moveDown(); String name = reader.getNodeName(); LOGGER.debug("node name = {}", name); try { Metacard metacard = (Metacard) context.convertAnother(null, MetacardImpl.class, transformProvider); metacards.add(metacard); } catch (ConversionException e) { LOGGER.warn( <START> "Failed to convert result to a metacard. Ignoring this resource because: " + e); <END> cswRecords.setNumberOfRecordsMatched(cswRecords.getNumberOfRecordsMatched() - 1); } reader.moveUp(); } } reader.moveUp(); } LOGGER.debug("Unmarshalled metacards", metacards.size()); if (LOGGER.isTraceEnabled()) { int index = 1; for (Metacard m : metacards) { LOGGER.trace("metacard {}: ", index); LOGGER.trace(" id = {}", m.getId()); LOGGER.trace(" title = {}", m.getTitle()); Attribute boundingBoxAttr = m.getAttribute("BoundingBox"); if (boundingBoxAttr != null) { LOGGER.trace(" bounding box = {}", boundingBoxAttr.getValue()); } index++; } } return cswRecords; }</code><technical_language>Concatenating exception String call toString() exception. generally provide information, pass exception in a parameter warn method logging framework print stack trace for us. said, thinking this more, I log exception DEBUG level warn message "Set log level DEBUG for more information". Otherwise, this exception spam logs a bit, depending scenario</technical_language>

Target:
public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) { if (transformProvider == null) { throw new ConversionException( "Unable to locate Converter for outputSchema: " + CswConstants.CSW_OUTPUT_SCHEMA); } CswRecordCollection cswRecords = new CswRecordCollection(); List<Metacard> metacards = cswRecords.getCswRecords(); XStreamAttributeCopier.copyXmlNamespaceDeclarationsIntoContext(reader, context); while (reader.hasMoreChildren()) { reader.moveDown(); if (reader.getNodeName().contains("SearchResults")) { setSearchResults(reader, cswRecords); while (reader.hasMoreChildren()) { reader.moveDown(); String name = reader.getNodeName(); LOGGER.debug("node name = {}", name); try { Metacard metacard = (Metacard) context.convertAnother(null, MetacardImpl.class, transformProvider); metacards.add(metacard); } catch (ConversionException e) { LOGGER.warn( "Failed to convert result to a metacard. Ignoring this resource. Set the log level to DEBUG for more information."); LOGGER.debug("Failed to convert result to a metacard.", e); cswRecords.setNumberOfRecordsMatched(cswRecords.getNumberOfRecordsMatched() - 1); } reader.moveUp(); } } reader.moveUp(); } LOGGER.debug("Unmarshalled metacards", metacards.size()); if (LOGGER.isTraceEnabled()) { int index = 1; for (Metacard m : metacards) { LOGGER.trace("metacard {}: ", index); LOGGER.trace(" id = {}", m.getId()); LOGGER.trace(" title = {}", m.getTitle()); Attribute boundingBoxAttr = m.getAttribute("BoundingBox"); if (boundingBoxAttr != null) { LOGGER.trace(" bounding box = {}", boundingBoxAttr.getValue()); } index++; } } return cswRecords; }