Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed a bug that can cause an OutOfBoundsException if debugging is enabled. #247

Merged
merged 1 commit into from
May 5, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions core/src/org/sbml/jsbml/ASTNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -1821,10 +1821,19 @@ public ASTNode(Type type, MathContainer parent) {
* the node to add as child.
*/
public void addChild(ASTNode child) {
/*
This code for debugging was commented out because it can cause an OutOfBoundsException during
the parsing of a model if it contains a lambda element. The reason for this is that
in astNodeToTree units are derived for the node and for lambda nodes the children
are necessary for this derivation. The children are not yet present however as addChild()
is responsible for adding them.
*/
/*
if (isDebugEnabled) {
logger.debug(" adding child current node: \n" + astNodeToTree(this, "", ""));
logger.debug(" adding child: \n" + astNodeToTree(child, "", ""));
}
*/
Comment on lines +1824 to +1836
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes a concrete problem but the underlying source still remains. A new tracker item has been created to keep this active. For now, it is solved.

listOfNodes.add(child);
setParentSBMLObject(child, parentSBMLObject, 0);
child.setParent(this);
Expand Down