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

sdedic 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 f670fdf4d4 Use ex.printStackTrace(StringWriter) to avoid no message NPE
     new 2aa9a73d54 Merge pull request #6189 from 
jtulach/jtulach/AvoidNPEWhenNoMessage
f670fdf4d4 is described below

commit f670fdf4d401c0a5c4034cc4fbed103aa5e5f12e
Author: Jaroslav Tulach <jaroslav.tul...@apidesign.org>
AuthorDate: Wed Jul 12 16:47:04 2023 +0100

    Use ex.printStackTrace(StringWriter) to avoid no message NPE
---
 .../java/lsp/server/protocol/TextDocumentServiceImpl.java        | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git 
a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/TextDocumentServiceImpl.java
 
b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/TextDocumentServiceImpl.java
index ed00816ca4..759dae9a72 100644
--- 
a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/TextDocumentServiceImpl.java
+++ 
b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/TextDocumentServiceImpl.java
@@ -38,6 +38,8 @@ import java.net.URI;
 import java.net.URL;
 import java.time.Instant;
 import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
 import java.net.MalformedURLException;
 import java.net.URISyntaxException;
 import java.util.ArrayList;
@@ -1069,8 +1071,11 @@ public class TextDocumentServiceImpl implements 
TextDocumentService, LanguageCli
                     }
                 });
             } catch (ParseException ex) {
-                //TODO: include stack trace:
-                client.logMessage(new MessageParams(MessageType.Error, 
ex.getMessage()));
+                StringWriter w = new StringWriter();
+                try (PrintWriter pw = new PrintWriter(w)) {
+                  ex.printStackTrace(pw);
+                }
+                client.logMessage(new MessageParams(MessageType.Error, 
w.toString()));
             } finally {
                 resultFuture.complete(result);
             }


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

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

Reply via email to