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/02/22 19:03:21 UTC

[GitHub] [netbeans] matthiasblaesing opened a new pull request #2775: Fix NPE in BreadcrumbsImpl, Update TextMate library, update typescript grammer and language server

matthiasblaesing opened a new pull request #2775:
URL: https://github.com/apache/netbeans/pull/2775


   


----------------------------------------------------------------
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


[GitHub] [netbeans] matthiasblaesing merged pull request #2775: Fix NPE in BreadcrumbsImpl, Update TextMate library, update typescript grammer and language server

Posted by GitBox <gi...@apache.org>.
matthiasblaesing merged pull request #2775:
URL: https://github.com/apache/netbeans/pull/2775


   


----------------------------------------------------------------
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


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

Posted by GitBox <gi...@apache.org>.
sdedic commented on a change in pull request #2775:
URL: https://github.com/apache/netbeans/pull/2775#discussion_r588878614



##########
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:
       Nothing overly important, just a predictable ordering of the output.




----------------------------------------------------------------
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


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

Posted by GitBox <gi...@apache.org>.
matthiasblaesing commented on a change in pull request #2775:
URL: https://github.com/apache/netbeans/pull/2775#discussion_r588610631



##########
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:
       Valid point - updated PR accordingly. Thank you.




----------------------------------------------------------------
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


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

Posted by GitBox <gi...@apache.org>.
matthiasblaesing commented on a change in pull request #2775:
URL: https://github.com/apache/netbeans/pull/2775#discussion_r588613864



##########
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:
       These files are independent from each other, so creation order of the license files does not matter for minimizing the diff. The order only matters in the binaries-list. But maybe I'm overlooking something?




----------------------------------------------------------------
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


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

Posted by GitBox <gi...@apache.org>.
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


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

Posted by GitBox <gi...@apache.org>.
matthiasblaesing commented on a change in pull request #2775:
URL: https://github.com/apache/netbeans/pull/2775#discussion_r588592204



##########
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:
       Thank you for checking this. However I checked a few of the files in the core project, and I see EPL-v2.0 - checked:
   
   https://github.com/eclipse/tm4e/blob/0.4.1/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/registry/Registry.java
   https://github.com/eclipse/tm4e/blob/0.4.1/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal/grammar/Grammar.java
   https://github.com/eclipse/tm4e/blob/0.4.1/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal/grammar/parser/Raw.java
   https://github.com/eclipse/tm4e/blob/0.4.1/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal/grammar/reader/SyncGrammarReader.java
   https://github.com/eclipse/tm4e/blob/0.4.1/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal/parser/xml/XMLPListParser.java
   https://github.com/eclipse/tm4e/blob/0.4.1/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/grammar/IGrammar.java
   https://github.com/eclipse/tm4e/blob/0.4.1/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/model/Tokenizer.java
   https://github.com/eclipse/tm4e/blob/master/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/theme/RGB.java
   https://github.com/eclipse/tm4e/blob/master/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/theme/css/CSSStyle.java
   https://github.com/eclipse/tm4e/blob/0.4.1/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/model/DecodeMap.java




----------------------------------------------------------------
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


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

Posted by GitBox <gi...@apache.org>.
matthiasblaesing commented on pull request #2775:
URL: https://github.com/apache/netbeans/pull/2775#issuecomment-792005703


   @sdedic @jlahoda thank you for review.


----------------------------------------------------------------
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