You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2021/03/05 08:36:35 UTC

[GitHub] [netbeans] sdedic commented on a change in pull request #2775: Fix NPE in BreadcrumbsImpl, Update TextMate library, update typescript grammer and language server

sdedic commented on a change in pull request #2775:
URL: https://github.com/apache/netbeans/pull/2775#discussion_r588091364



##########
File path: ide/lsp.client/src/org/netbeans/modules/lsp/client/bindings/BreadcrumbsImpl.java
##########
@@ -104,33 +102,31 @@ private DocumentSymbol toDocumentSymbol(Either<SymbolInformation, DocumentSymbol
     }
 
     private void update() {
-        BreadcrumbsElement element;
-
-        synchronized (this) {
-            element = this.rootElement;
-        }
+        BreadcrumbsElement element = this.rootElement;
 
         if (element == null) {
             return ;
         }
 
-        element = ((RootBreadcrumbsElementImpl) element).children.get(0);
-        //TODO: stale results... modified while the query is running?
+        if (comp.getCaret() != null && (!element.getChildren().isEmpty())) {
+            element = element.getChildren().get(0);
 
-        int caret = comp.getCaretPosition();
+            int caret = comp.getCaretPosition();

Review comment:
       This does not entirely fix the NPE, IMHO. Better obtain the `Caret` and if not `null`, call `getDot()`. `getCaretPosition()` dereferences `caret`, so there's still slight chance of race.

##########
File path: webcommon/typescript.editor/bundles/prepare/src/main/java/org/netbeans/modules/learning/prepare/PrepareBundles.java
##########
@@ -163,27 +166,32 @@ public static void main(String... args) throws IOException, InterruptedException
                     });
                 }
                 MessageDigest md = MessageDigest.getInstance("SHA1");
-                try (InputStream in = Files.newInputStream(bundle)) {
-                    md.update(in.readAllBytes());
-                }
+                md.update(Files.readAllBytes(bundle));
                 StringBuilder hash = new StringBuilder();
                 for (byte b : md.digest()) {
                     hash.append(String.format("%02X", b));
                 }
                 Path external = externalDir.resolve(hash + "-" + bundle.getFileName());
                 Files.copy(bundle, external);
-                binariesList.write(hash + " " + bundle.getFileName().toString() + nl);
+                binaries.put(bundle.getFileName().toString(), hash.toString());
             }
         }
-        
+
+        try(Writer binariesList = new OutputStreamWriter(Files.newOutputStream(bundlesDir.resolve("binaries-list")), "UTF-8")) {
+            binariesList.write(readResourceIntoString("ALv2Header.txt"));
+            for(Entry<String,String> e: binaries.entrySet()) {
+                binariesList.write(e.getValue() + " " + e.getKey() + nl);
+            }
+        }
+
         Map<String, String> project2LicenseKey = new HashMap<>();

Review comment:
       Consider converting to `TreeMap`, too as the `-license.txt` is created in entrySet-iteration order.

##########
File path: ide/textmate.lexer/external/org.eclipse.tm4e.core-0.4.1-pack1-license.txt
##########
@@ -0,0 +1,92 @@
+Name: TextMate support for Eclipse
+Version: 0.4.1-pack1
+License: EPL-v20
+Description: Used to interpret TextMate grammars
+Origin: https://github.com/eclipse/tm4e
+
+Eclipse Public License - v 2.0

Review comment:
       Possible mimatch: https://github.com/eclipse/tm4e/blob/master/LICENSE states EPL 1.0 even in the master version.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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

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