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

stopToWay is never cleared #35

Open
stalker314314 opened this issue Nov 23, 2020 · 5 comments
Open

stopToWay is never cleared #35

stalker314314 opened this issue Nov 23, 2020 · 5 comments
Assignees

Comments

@stalker314314
Copy link

I had very weird problems where I got errors of sort:
"The last stop of the route does not match the last way"
that cannot go away.

So, while debugging, it turns out that stopToWay in line

public static Map<PTStop, List<Way>> stopToWay = new HashMap<>();
is defined as static and is never cleared. So, when I move node where I want it to be (near last way), stopToWay never get that information as it takes it from cache. Only way is to restart JOSM. So, to make my problem go away, I just dropped stopToWay.clear(); in StopToWayAssigner ctor and it works now. I guess this is not solution for PR, just a hack, but wanted to let you know here

@sudhanshu2 sudhanshu2 self-assigned this Dec 4, 2020
@sudhanshu2
Copy link
Collaborator

Do you have a list of steps that I could follow to reproduce this error, or were you trying something in particular when it occurred?

@stalker314314
Copy link
Author

Find some first/end stop where first/last way is not nearest to it (for example, first stop is nearest to second way...). Click validation and you will get this "The last stop of the route does not match the last way" message (do not click validation before you move it, not to populate cache beforehand, or even better - move stop, commit, restart JOSM and load route). If you now move first/last stop so that first/last way is nearest to it, validation message do not go away (because cache is already pre-populated and is not invalidated when you move stop back). If you want more specific, I can craft simple PT route with this error?

@stalker314314
Copy link
Author

stalker314314 commented Dec 22, 2020

Here is most recent example: https://www.openstreetmap.org/relation/6964212. First stop ("Borca 3") is not near first way. If you validate, you will get error. However, if you move "Borca 3" to the east, so first way is closest, you will still get this validation error. If you do what I did with cache (clear it in ctor), error will go away on subsequent validations

@sudhanshu2
Copy link
Collaborator

Thank you so much, I will try and get it done this week!

@sudhanshu2
Copy link
Collaborator

I have changed the code and I think it should work now, but it is a bit hacky method (it is essentially doing what you did in constructor) so I am looking more deeply into why that variable is static in the first place.

@sudhanshu2 sudhanshu2 linked a pull request Dec 29, 2020 that will close 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

Successfully merging a pull request may close this issue.

2 participants