diff --git a/modules/core/core-content/src/main/java/com/enonic/xp/core/impl/content/ContentServiceImpl.java b/modules/core/core-content/src/main/java/com/enonic/xp/core/impl/content/ContentServiceImpl.java index a2eae431d5e..a9007f6ac57 100644 --- a/modules/core/core-content/src/main/java/com/enonic/xp/core/impl/content/ContentServiceImpl.java +++ b/modules/core/core-content/src/main/java/com/enonic/xp/core/impl/content/ContentServiceImpl.java @@ -1116,7 +1116,12 @@ public ByteSource getBinary( final ContentId contentId, final BinaryReference bi return Tracer.trace( "content.getBinary", trace -> { trace.put( "id", contentId ); trace.put( "reference", binaryReference ); - }, command::execute, ( trace, byteSource ) -> trace.put( "size", byteSource.sizeIfKnown().or( -1L ) ) ); + }, command::execute, ( trace, byteSource ) -> { + if ( byteSource != null ) + { + trace.put( "size", byteSource.sizeIfKnown().or( -1L ) ); + } + } ); } @Override @@ -1132,7 +1137,12 @@ public ByteSource getBinary( final ContentId contentId, final ContentVersionId c trace.put( "id", contentId ); trace.put( "versionId", contentVersionId ); trace.put( "reference", binaryReference ); - }, command::execute, ( trace, byteSource ) -> trace.put( "size", byteSource.sizeIfKnown().or( -1L ) ) ); + }, command::execute, ( trace, byteSource ) -> { + if ( byteSource != null ) + { + trace.put( "size", byteSource.sizeIfKnown().or( -1L ) ); + } + } ); } @Override diff --git a/modules/core/core-repo/src/main/java/com/enonic/xp/repo/impl/node/NodeServiceImpl.java b/modules/core/core-repo/src/main/java/com/enonic/xp/repo/impl/node/NodeServiceImpl.java index 08ea705d52b..db7957afbc3 100644 --- a/modules/core/core-repo/src/main/java/com/enonic/xp/repo/impl/node/NodeServiceImpl.java +++ b/modules/core/core-repo/src/main/java/com/enonic/xp/repo/impl/node/NodeServiceImpl.java @@ -184,8 +184,12 @@ private Node doGetById( final NodeId id ) @Override public Node getByPath( final NodePath path ) { - return Tracer.trace( "node.getByPath", trace -> trace.put( "path", path ), () -> executeGetByPath( path ), - ( trace, node ) -> trace.put( "id", node.id() ) ); + return Tracer.trace( "node.getByPath", trace -> trace.put( "path", path ), () -> executeGetByPath( path ), ( trace, node ) -> { + if ( node != null ) + { + trace.put( "id", node.id() ); + } + } ); } private Node executeGetByPath( final NodePath path ) @@ -806,7 +810,12 @@ public ByteSource getBinary( final NodeId nodeId, final BinaryReference referenc return Tracer.trace( "node.getBinary", trace -> { trace.put( "id", nodeId ); trace.put( "reference", reference ); - }, () -> executeGetBinary( nodeId, reference ), ( trace, byteSource ) -> trace.put( "size", byteSource.sizeIfKnown().or( -1L ) ) ); + }, () -> executeGetBinary( nodeId, reference ), ( trace, byteSource ) -> { + if ( byteSource != null ) + { + trace.put( "size", byteSource.sizeIfKnown().or( -1L ) ); + } + } ); } private ByteSource executeGetBinary( final NodeId nodeId, final BinaryReference reference ) @@ -827,11 +836,15 @@ private ByteSource executeGetBinary( final NodeId nodeId, final BinaryReference public ByteSource getBinary( final NodeId nodeId, final NodeVersionId nodeVersionId, final BinaryReference reference ) { return Tracer.trace( "node.getBinary", trace -> { - trace.put( "id", nodeId ); - trace.put( "versionId", nodeVersionId ); - trace.put( "reference", reference ); - }, () -> executeGetBinary( nodeId, nodeVersionId, reference ), - ( trace, byteSource ) -> trace.put( "size", byteSource.sizeIfKnown().or( -1L ) ) ); + trace.put( "id", nodeId ); + trace.put( "versionId", nodeVersionId ); + trace.put( "reference", reference ); + }, () -> executeGetBinary( nodeId, nodeVersionId, reference ), ( trace, byteSource ) -> { + if ( byteSource != null ) + { + trace.put( "size", byteSource.sizeIfKnown().or( -1L ) ); + } + } ); } private ByteSource executeGetBinary( final NodeId nodeId, final NodeVersionId nodeVersionId, final BinaryReference reference )