Skip to content

getMessage: Fix crash on origins with no URL property

vlorentz requested to merge vlorentz/swh-graph:missing-origin-url into master

It does happen in practice somehow...

SEVERE: Exception while executing runnable io.grpc.internal.ServerImpl$JumpToApplicationThreadServerStreamListener$1HalfClosed@3b2a4ef4
java.lang.NullPointerException: Cannot read the array length because "src" is null
        at java.base/java.util.Base64$Decoder.decode(Base64.java:565)
        at org.softwareheritage.graph.SwhGraphProperties.getMessage(SwhGraphProperties.java:358)
        at org.softwareheritage.graph.SwhGraphProperties.getUrl(SwhGraphProperties.java:375)
        at org.softwareheritage.graph.SwhGraph.getUrl(SwhGraph.java:144)
        at org.softwareheritage.graph.rpc.NodePropertyBuilder.buildNodeProperties(NodePropertyBuilder.java:167)
        at org.softwareheritage.graph.rpc.Traversal$SimpleTraversal.visitNode(Traversal.java:279)
        at org.softwareheritage.graph.rpc.Traversal$BFSVisitor.visitStep(Traversal.java:197)
        at org.softwareheritage.graph.rpc.Traversal$BFSVisitor.visitStep(Traversal.java:186)
        at org.softwareheritage.graph.rpc.Traversal$BFSVisitor.visit(Traversal.java:173)
        at org.softwareheritage.graph.rpc.GraphServer$TraversalService.traverse(GraphServer.java:223)
        at org.softwareheritage.graph.rpc.TraversalServiceGrpc$MethodHandlers.invoke(TraversalServiceGrpc.java:814)
        at io.grpc.stub.ServerCalls$UnaryServerCallHandler$UnaryServerCallListener.onHalfClose(ServerCalls.java:182)
        at io.grpc.internal.ServerCallImpl$ServerStreamListenerImpl.halfClosed(ServerCallImpl.java:352)
        at io.grpc.internal.ServerImpl$JumpToApplicationThreadServerStreamListener$1HalfClosed.runInContext(ServerImpl.java:866)
        at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
        at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:133)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
        at java.base/java.lang.Thread.run(Thread.java:833)

and NodePropertyBuilder.buildNodeProperties has code explicitly handling a null return from this function.

Merge request reports