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

Exception when trying to insert a large String #15

Closed
mfazeen opened this issue Oct 25, 2015 · 5 comments
Closed

Exception when trying to insert a large String #15

mfazeen opened this issue Oct 25, 2015 · 5 comments

Comments

@mfazeen
Copy link

mfazeen commented Oct 25, 2015

Hi,

You have done a wonderful job in the implementation. However, when I try to insert a large String (I can provide the test string) It throws the following exception. It never completed inserting the full string.

Exception in thread "main" java.lang.NullPointerException
at SuffixTree.nextChar(SuffixTree.java:426)
at SuffixTree.startPhase(SuffixTree.java:322)
at SuffixTree.build(SuffixTree.java:143)
at SuffixTree.main(SuffixTree.java:101)

The string I was trying to insert was 63027 in length. However, another large string with a length of 63067 inserted without any errors (I can provide this test string as well).

However, the second large string failed at your validation function;

Failed at 58 for index 56
Failed validation
false

I was trying to debug it but couldn't track it down. Wanted to bring it to your attention. Thanks.

@mission-peace
Copy link
Owner

I will look at it. I think there is error in validation function. Do you see infinite loop in some reasonable size string which can be debugged?

 On Sunday, October 25, 2015 1:46 PM, mfazeen <notifications@github.com> wrote:

Hi,You have done a wonderful job in the implementation. However, when I try to insert a large String (I can provide the test string) It throws the following exception. It never completed inserting the full string.Exception in thread "main" java.lang.NullPointerException
at SuffixTree.nextChar(SuffixTree.java:426)
at SuffixTree.startPhase(SuffixTree.java:322)
at SuffixTree.build(SuffixTree.java:143)
at SuffixTree.main(SuffixTree.java:101)The string i was trying to insert was 63027 in length. However, another large string with a length of 63067 inserted without and error (I can provide this test string as well). However, the second large string failed at your validation function;Failed at 58 for index 56
Failed validation
falseI was trying to debug it but couldn't track it down. Wanted to bring it to your attention. Thanks.—
Reply to this email directly or view it on GitHub.

@mfazeen
Copy link
Author

mfazeen commented Oct 26, 2015

Hi,
Thank you for your prompt reply. The NullPointerException is thrown even before it gets to the validation function. It did not load the complete string to the tree.

The exception is generated when the nextChar(int i) function try to access the start value of the activeNode child at the line:

return input[active.activeNode.child[input[active.activeEdge]].start + active.activeLength];

(last return statement in the else block in the nextChar function)

At this line the "active.activeNode.child[input[active.activeEdge]]" is null for sum reason and that failed the tree creation.
I.e. the activeNode child at the input[active.activeEdge] location is null for some reason. I assume that either this child is not created correctly in a previous step or the index of the child is incorrect. Hope this will help you.

I did not see any infinite loops though.
Thanks

@mission-peace
Copy link
Owner

I meant do you have a smaller example where you get NPE instead of this 63K long string.

@mfazeen
Copy link
Author

mfazeen commented Oct 26, 2015

Sorry, I did not get any NPE with smaller strings that I tried with. If I come across one I will let you know.

@mission-peace
Copy link
Owner

fixed some bugs. Probably that will fix this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants