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

fix: Corrected a problem where the version was null in the desktop version. #1643

Conversation

jcpitre
Copy link
Contributor

@jcpitre jcpitre commented Jan 15, 2024

Summary:
closes #1606
The version in the html report was null with the desktop version of the validator.

Expected behavior:

It should be the current version.

Please make sure these boxes are checked before submitting your pull request - thanks!

  • Run the unit tests with gradle test to make sure you didn't break anything
  • Add or update any needed documentation to the repo
  • Format the title like "feat: [new feature short description]". Title must follow the Conventional Commit Specification(https://www.conventionalcommits.org/en/v1.0.0/).
  • Linked all relevant issues
  • Include screenshot(s) showing how this pull request works and fixes the issue(s)

@jcpitre jcpitre linked an issue Jan 15, 2024 that may be closed by this pull request
@jcpitre jcpitre marked this pull request as draft January 15, 2024 23:06
Copy link
Contributor

✅ Rule acceptance tests passed.
New Errors: 0 out of 1479 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
Dropped Errors: 0 out of 1479 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
New Warnings: 0 out of 1479 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
Dropped Warnings: 0 out of 1479 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
0 out of 1479 sources (~0 %) are corrupted.
Commit: f709461
Download the full acceptance test report here (report will disappear after 90 days).
✅ Rule acceptance tests passed.

@jcpitre jcpitre changed the title Corrected a problem where the version was null in the desktop version. fix: Corrected a problem where the version was null in the desktop version. Jan 16, 2024
@jcpitre
Copy link
Contributor Author

jcpitre commented Jan 16, 2024

This is the Exception that caused the problem.

SEVERE: Error resolving version infojava.lang.RuntimeException: Unable to invoke no-args constructor for class org.mobilitydata.gtfsvalidator.util.VersionResolver$VersionResponse. Registering an InstanceCreator with Gson for this type may fix this problem.
	at org.mobilitydata.gtfsvalidator.app.gui@4.2.1-SNAPSHOT/com.google.gson.internal.ConstructorConstructor$14.construct(Unknown Source)
	at org.mobilitydata.gtfsvalidator.app.gui@4.2.1-SNAPSHOT/com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(Unknown Source)
	at org.mobilitydata.gtfsvalidator.app.gui@4.2.1-SNAPSHOT/com.google.gson.Gson.fromJson(Unknown Source)
	at org.mobilitydata.gtfsvalidator.app.gui@4.2.1-SNAPSHOT/com.google.gson.Gson.fromJson(Unknown Source)
	at org.mobilitydata.gtfsvalidator.app.gui@4.2.1-SNAPSHOT/org.mobilitydata.gtfsvalidator.util.VersionResolver.resolveLatestReleaseVersion(Unknown Source)
	at org.mobilitydata.gtfsvalidator.app.gui@4.2.1-SNAPSHOT/org.mobilitydata.gtfsvalidator.util.VersionResolver.lambda$resolve$0(Unknown Source)
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.UnsupportedOperationException: Cannot allocate class org.mobilitydata.gtfsvalidator.util.VersionResolver$VersionResponse
	at org.mobilitydata.gtfsvalidator.app.gui@4.2.1-SNAPSHOT/com.google.gson.internal.UnsafeAllocator$4.newInstance(Unknown Source)
	... 10 more

I suspect it has to do with the fact that the jars have to be converted to java modules to be able to use jpackage. jpackage creates the installers.
Java modules must have a different way to manage class loaders that resulted in the Exception. This is partly speculation on my part.

Addendum:
Now that I think of it, it seems that the way it was before was wrong and I don't know how it worked.
VersionResolver had a package visibility. Then how come the class could be used in a call to a method from outside the package gson.fromJson(in, VersionResponse.class) ?

@jcpitre jcpitre marked this pull request as ready for review January 16, 2024 05:03
Copy link
Contributor

✅ Rule acceptance tests passed.
New Errors: 0 out of 1477 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
Dropped Errors: 0 out of 1477 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
New Warnings: 0 out of 1477 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
Dropped Warnings: 0 out of 1477 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
2 out of 1479 sources (~0 %) are corrupted.
Corrupted sources:
us-maryland-bwi-thurgood-marshall-airport-bwi-shuttle-gtfs-490
us-massachusetts-peter-pan-gtfs-496
Commit: 69c96b6
Download the full acceptance test report here (report will disappear after 90 days).
✅ Rule acceptance tests passed.

Copy link
Member

@davidgamez davidgamez left a comment

Choose a reason for hiding this comment

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

LGTM!

@bdferris-v2
Copy link
Collaborator

bdferris-v2 commented Jan 16, 2024

If this really is the fix, then I'm also not sure why it worked before. Which is to say, maybe it never did in a packaged application, as you mentioned.

Copy link
Contributor

✅ Rule acceptance tests passed.
New Errors: 0 out of 1479 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
Dropped Errors: 0 out of 1479 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
New Warnings: 0 out of 1479 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
Dropped Warnings: 0 out of 1479 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
0 out of 1479 sources (~0 %) are corrupted.
Commit: 0129f95
Download the full acceptance test report here (report will disappear after 90 days).
✅ Rule acceptance tests passed.

@jcpitre jcpitre merged commit c19527b into master Jan 16, 2024
333 checks passed
@jcpitre jcpitre deleted the 1606-report-generated-from-desktop-app-not-showing-version-number branch January 16, 2024 21:02
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.

Report generated from desktop app not showing version number
3 participants