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 2022/02/12 20:06:11 UTC

[GitHub] [netbeans] matthiasblaesing opened a new pull request #3597: Fix csl elementhandle

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


   The contract for StructureItem#getElementHandle is not always honored and implementors return `null`.
   This causes NullPointer Exceptions in `ElementNode` which relies on it being present.
   
   This changesets adds a guard to prevent invalid implementations to raise exceptions and fixes the CSS
   code to provide the required `ElementHandle` implementations.


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

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

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] neilcsmith-net merged pull request #3597: [#3593] Fix csl elementhandle

Posted by GitBox <gi...@apache.org>.
neilcsmith-net merged pull request #3597:
URL: https://github.com/apache/netbeans/pull/3597


   


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

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

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] junichi11 commented on a change in pull request #3597: [#3593] Fix csl elementhandle

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



##########
File path: ide/csl.api/src/org/netbeans/modules/csl/navigation/ElementNode.java
##########
@@ -242,7 +243,15 @@ public ElementNode getNodeForOffset(int offset) {
             Node[] children = ch.getNodes();
             for (int i = 0; i < children.length; i++) {
                 ElementNode c = (ElementNode) children[i];
-                if (this.getFileObject() != c.getDescription().getElementHandle().getFileObject()) {
+                // The promise of the API is broken at several places in the
+                // codebase and thus this needs to be guarded. The assert is in
+                // place to find the violating places.
+                assert c.getDescription().getElementHandle() != null;

Review comment:
       Nice!




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

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

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] junichi11 commented on a change in pull request #3597: [#3593] Fix csl elementhandle

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



##########
File path: ide/csl.api/src/org/netbeans/modules/csl/navigation/ElementNode.java
##########
@@ -242,7 +243,15 @@ public ElementNode getNodeForOffset(int offset) {
             Node[] children = ch.getNodes();
             for (int i = 0; i < children.length; i++) {
                 ElementNode c = (ElementNode) children[i];
-                if (this.getFileObject() != c.getDescription().getElementHandle().getFileObject()) {
+                // The promise of the API is broken at several places in the
+                // codebase and thus this needs to be guarded. The assert is in
+                // place to find the violating places.
+                assert c.getDescription().getElementHandle() != null;

Review comment:
       Nice!




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

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

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] neilcsmith-net merged pull request #3597: [#3593] Fix csl elementhandle

Posted by GitBox <gi...@apache.org>.
neilcsmith-net merged pull request #3597:
URL: https://github.com/apache/netbeans/pull/3597


   


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

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

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