From 1ab9932df2e2236dd8e02cae36f9a11efbc2302d Mon Sep 17 00:00:00 2001 From: Knut Wannheden Date: Thu, 28 Nov 2024 08:59:43 +0100 Subject: [PATCH] Use new socket for each source file As a workaround for the issue we have with the JS process returning the LST for a previously parsed source file, the Java parser frontend now creates a new socket for each source file being parsed. --- .../main/java/org/openrewrite/javascript/JavaScriptParser.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/rewrite-javascript/src/main/java/org/openrewrite/javascript/JavaScriptParser.java b/rewrite-javascript/src/main/java/org/openrewrite/javascript/JavaScriptParser.java index 020d1249..e7823302 100644 --- a/rewrite-javascript/src/main/java/org/openrewrite/javascript/JavaScriptParser.java +++ b/rewrite-javascript/src/main/java/org/openrewrite/javascript/JavaScriptParser.java @@ -96,7 +96,7 @@ public Stream parseInputs(Iterable inputs, @Nullable Path rel assert client != null; assert remotingContext != null; try (EncodingDetectingInputStream is = input.getSource(ctx)) { - SourceFile parsed = client.runUsingSocket((socket, messenger) -> requireNonNull(messenger.sendRequest(generator -> { + SourceFile parsed = client.withNewSocket((socket, messenger) -> requireNonNull(messenger.sendRequest(generator -> { if (input.isSynthetic() || !Files.isRegularFile(input.getPath())) { generator.writeString("parse-source"); generator.writeString(is.readFully()); @@ -109,7 +109,6 @@ public Stream parseInputs(Iterable inputs, @Nullable Path rel Tree tree = RemotingMessenger.receiveTree(remotingContext, parser,null); return (SourceFile) tree; }, socket))) - .withSourcePath(path) .withFileAttributes(FileAttributes.fromPath(input.getPath())) .withCharset(getCharset(ctx));