You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by en...@apache.org on 2021/11/30 10:27:23 UTC

[netbeans] branch master updated: Check for nativeImagePath property.

This is an automated email from the ASF dual-hosted git repository.

entl pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git


The following commit(s) were added to refs/heads/master by this push:
     new 4ad8b87  Check for nativeImagePath property.
4ad8b87 is described below

commit 4ad8b8731c74b3290558918474dc640799b5a95f
Author: Martin Entlicher <ma...@oracle.com>
AuthorDate: Mon Nov 29 16:38:02 2021 +0100

    Check for nativeImagePath property.
---
 .../lsp/server/debugging/attach/NbAttachRequestHandler.java    | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/debugging/attach/NbAttachRequestHandler.java b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/debugging/attach/NbAttachRequestHandler.java
index 418ddad..f2cb8e0 100644
--- a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/debugging/attach/NbAttachRequestHandler.java
+++ b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/debugging/attach/NbAttachRequestHandler.java
@@ -50,6 +50,7 @@ import org.netbeans.modules.java.lsp.server.debugging.utils.ErrorUtilities;
 import org.netbeans.modules.java.lsp.server.protocol.NbCodeLanguageClient;
 import org.netbeans.modules.java.nativeimage.debugger.api.NIDebugRunner;
 import org.netbeans.modules.nativeimage.api.debug.NIDebugger;
+import org.openide.util.NbBundle;
 import org.openide.util.NbBundle.Messages;
 import org.openide.util.RequestProcessor;
 
@@ -82,6 +83,7 @@ public final class NbAttachRequestHandler {
         }
     }
 
+    @NbBundle.Messages("MSG_UnknownNIPath=Unknown native image path. Please set `nativeImagePath`.")
     private CompletableFuture<Void> attachToNative(Map<String, Object> attachArguments, DebugAdapterContext context) {
         CompletableFuture<Void> resultFuture = new CompletableFuture<>();
         String processAndExe = (String) attachArguments.get("processId");   // NOI18N
@@ -92,11 +94,17 @@ public final class NbAttachRequestHandler {
         try {
             if (index > 0) {
                 processId = Long.parseLong(processAndExe.substring(0, index));
-                if (nativeImagePath.isEmpty()) {
+                if (nativeImagePath == null || nativeImagePath.isEmpty()) {
                     nativeImagePath = processAndExe.substring(index + 1);
                 }
             } else {
                 processId = Long.parseLong(processAndExe);
+                if (nativeImagePath == null) {
+                    ErrorUtilities.completeExceptionally(resultFuture,
+                            Bundle.MSG_UnknownNIPath(),
+                            ResponseErrorCode.serverErrorStart);
+                    return resultFuture;
+                }
             }
             String executable = nativeImagePath;
             RP.post(() -> attachNativeDebug(new File(executable), processId, miDebugger, context, resultFuture));

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists