riddlesio / issues

Bug reports and starter bot submissions for the Riddles.io platform
0 stars 0 forks source link

Java Class Not Found #43

Closed Phlosioneer closed 7 years ago

Phlosioneer commented 7 years ago

When uploading a java bot, a common mistake is to zip the root folder, and upload that. However, this leads the compiled java binary to look for a main class at <name_of_project>.main.MainClass, when it should be looking at main.MainClass.

It spent me 2 hours and 14 uploaded zip files to figure out what was going on. That's a waste of my time and your servers' resources.

A simple way to fix this problem is to check if the first (and only) folder in the zip file is the same name as the zip file. A slightly more robust way to fix this problem is to warn the user if the uploaded zip file only contains one folder at its root. A very robust way to fix this problem is to find a .java file somewhere (anywhere) in the zip file, and check that its package foo.bar; statement matches its directory: blah.zip/foo/bar.

In whatever solution is chosen, a warning should be given to the user with a description of how to properly create a zip file; it's best to avoid an error just in case it is a valid java project that just happens to have one root package with the same name as the project.

Evidence others are having the same issue: https://booking.riddles.io/competitions/ms.-hack-man/discussions/discussion/b9a28cc3-78d3-4373-a0c2-987adb148336/1

JimVanEeden commented 7 years ago

Good points. We've seen this issue before, so I'm probably going to add a warning on compile fail so people know what the problem is.

nikovanmeurs commented 7 years ago

The patch has been deployed, I'm closing this issue.