gravitylow / Updater

Easy automatic updates for Bukkit
MIT License
35 stars 41 forks source link

Added Additional check to checkVersion as an Integer. #2

Closed deathmarine closed 12 years ago

deathmarine commented 12 years ago

I found an issue when testing one of my plugins. Added Additional check to check version string as an Integer. Example:

Major.Minor.Build BukkitDev Version 1.0.2 Current Version 1.1.3

113>102 !!Don't download and overwrite every time.

I wrote the first commit out as a test. Which failed for a null character. Currently latest commit works perfectly when changing the version string in the plugin.yml above or below the version saved to bukkitDev.

gravitylow commented 12 years ago

I typically use the allman style when doing Java stuff, it'd be appreciated if you could format it appropriately :)

deathmarine commented 12 years ago

Sure thing. :)

gravitylow commented 12 years ago

Oh, also, what if someone has a version with strings in it? I would like to allow people to use custom versions (i.e. not a simple X.X.X layout, but something else) - I understand why this could be an issue, but would we be effectively forcing the format to be only numbers by implementing this?

Also, why would there be a version you are using that has not been uploaded to BukkitDev?

deathmarine commented 12 years ago

For me personally none, other than its a pain to work with when testing a plugin. However I've seen posts that have a link to a "dev" build with a direct download from github for example. If they include the code it will overwrite the next version on restart.

The only way that I could see that this could be an issue is if the version does not contain the same length.
Example: 1.000.234 >1.000.32 Which would show false on the commit but would be picked up with the "does equal the orginal string" currently in the code.

I'll set the variable remote variable on catching a NumberFormatException to turn the commit code to false once again falling back to the does not equal portion and change the check from Character.isDigit(c)) to Character.isLetterOrDigit(c)).

gravitylow commented 12 years ago

Alright, that sounds fine as long as it's tested; you have tested this, right? And it works with both types of inputs?

deathmarine commented 12 years ago

Yup.. I'm using it right now. However I ran into another problem with users being offline throwing RuntimeException takes down the main thread.

https://github.com/deathmarine/Ultrabans/commit/52ca2276534961ed5de28899d48d461b7afbb302 was the fix I used.

gravitylow commented 12 years ago

By being offline, do you mean the server running in offline-mode?

deathmarine commented 12 years ago

Offline as in no connection to the internet. Unknown host exception was taking out the main threads.

gravitylow commented 12 years ago

Oh, by "support" you mean gracefully handling it instead of throwing an error.

gravitylow commented 12 years ago

Thank you sir.