Source:
<code>private void writeFromJcrProperty(SlingHttpServletRequest request, SlingHttpServletResponse response) throws IOException { if (!robotsContentsPropertyPath.startsWith("/")) { robotsContentsPropertyPath = request.getResource().getPath() + "/" + robotsContentsPropertyPath; } Session session = request.getResourceResolver().adaptTo(Session.class); boolean written = false; try { if (session.itemExists(robotsContentsPropertyPath)) { Item item = session.getItem(robotsContentsPropertyPath); <START> if (item instanceof Property) { <END> Property prop = (Property) item; int propertyType = prop.getType(); Value value = prop.getValue(); if (propertyType == PropertyType.BINARY) { Binary binary = value.getBinary(); InputStream stream = binary.getStream(); ByteStreams.copy(stream, response.getOutputStream()); written = true; } else if (propertyType == PropertyType.STRING) { response.getWriter().print(value.getString()); written = true; } } } if (!written) { log.error("no response was written while processing robots with jcr property {}", robotsContentsPropertyPath); response.sendError(HttpServletResponse.SC_NOT_FOUND); } } catch (RepositoryException e) { log.error("Repository Exception while processing robots with jcr property {}", robotsContentsPropertyPath, e); response.sendError(HttpServletResponse.SC_NOT_FOUND); } }</code><technical_language>log a WARN if this points a property/string/binary? is error a bit ambiguous failed</technical_language>

Target:
private void writeFromJcrProperty(SlingHttpServletRequest request, SlingHttpServletResponse response) throws IOException { String absoluteRobotsContentsPropertyPath = robotsContentsPropertyPath; if (!absoluteRobotsContentsPropertyPath.startsWith("/")) { absoluteRobotsContentsPropertyPath = request.getResource().getPath() + "/" + robotsContentsPropertyPath; } Session session = request.getResourceResolver().adaptTo(Session.class); boolean written = false; try { if (session.itemExists(absoluteRobotsContentsPropertyPath)) { Item item = session.getItem(absoluteRobotsContentsPropertyPath); if (item instanceof Property) { Property prop = (Property) item; int propertyType = prop.getType(); Value value = prop.getValue(); if (propertyType == PropertyType.BINARY) { Binary binary = value.getBinary(); InputStream stream = binary.getStream(); ByteStreams.copy(stream, response.getOutputStream()); written = true; } else if (propertyType == PropertyType.STRING) { response.getWriter().print(value.getString()); written = true; } else { log.warn("configured property found, but type is not String or Binary.", absoluteRobotsContentsPropertyPath, PropertyType.nameFromValue(propertyType)); } } else { log.warn("Item found at configured property {}, but is not a property.", absoluteRobotsContentsPropertyPath); } } else { log.warn("configured property does not exist.", absoluteRobotsContentsPropertyPath); } if (!written) { log.error("no response was written while processing robots with jcr property {}.", absoluteRobotsContentsPropertyPath); response.sendError(HttpServletResponse.SC_NOT_FOUND); } } catch (RepositoryException e) { log.error("Repository Exception while processing robots with jcr property {}", absoluteRobotsContentsPropertyPath, e); response.sendError(HttpServletResponse.SC_NOT_FOUND); } }