kwin commented on a change in pull request #19:
URL:
https://github.com/apache/sling-org-apache-sling-jcr-resource/pull/19#discussion_r784934453
##########
File path:
src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResource.java
##########
@@ -181,34 +185,15 @@ private InputStream getInputStream() {
final Node node = getNode();
if (node != null) {
try {
- // find the content node: for nt:file it is jcr:content
- // otherwise it is the node of this resource
- Node content = (node.isNodeType(NT_FILE) ||
- (node.isNodeType(NT_FROZEN_NODE) &&
-
node.getProperty(JCR_FROZEN_PRIMARY_TYPE).getString().equals(NT_FILE)))
- ? node.getNode(JCR_CONTENT)
- : node.isNodeType(NT_LINKED_FILE) ?
node.getProperty(JCR_CONTENT).getNode() : node;
-
Property data;
-
- // if the node has a jcr:data property, use that property
- if (content.hasProperty(JCR_DATA)) {
- data = content.getProperty(JCR_DATA);
- } else {
- // otherwise try to follow default item trail
- try {
- Item item = content.getPrimaryItem();
- while (item.isNode()) {
- item = ((Node) item).getPrimaryItem();
- }
- data = (Property) item;
-
- } catch (ItemNotFoundException infe) {
- // we don't actually care, but log for completeness
- LOGGER.debug("getInputStream: No primary items for
{}", toString(), infe);
- data = null;
- }
+ try {
+ data = getPrimaryProperty(node);
+ } catch (ItemNotFoundException infe) {
+ // we don't actually care, but log for completeness
+ LOGGER.debug("getInputStream: No primary items for {}",
toString(), infe);
+ data = null;
Review comment:
This hasn't changed in this PR, even before `data` could have been null
(see removed line 209)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]