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

Prevent ArrayIndexOutOfBoundsException when recording TemporalDensityResult #917

Merged
merged 1 commit into from
Dec 15, 2023

Conversation

ansoncfit
Copy link
Member

We decided our temporal density results have 120 columns (0 to 119). In the TemporalDensityResult constructor, the third dimension is 120:

this.opportunitiesPerMinute = new double[destinationPointSets.length][nPercentiles][120]

When recording results, opportunities should only be recorded if they are less than 120 minutes away, as proposed in this PR.

@ansoncfit ansoncfit requested a review from abyrd December 4, 2023 23:22
Copy link
Member

@abyrd abyrd left a comment

Choose a reason for hiding this comment

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

It's clear from the updated Javadoc and the constant array dimension in line 48/49 where the error came from, and that the patch will keep m within array index bounds. As mentioned on the call, we must not have generated a travel time of exactly 120 minutes in testing.

@abyrd abyrd merged commit ef9638b into dev Dec 15, 2023
3 checks passed
@abyrd abyrd deleted the opportunity-density-fix branch December 15, 2023 06:39
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

Successfully merging this pull request may close these issues.

None yet

2 participants