[1.3.b56] Vision Opacity can go beyond 100, throws error
Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice, MapTool BugReport Manager
[1.3.b56] Vision Opacity can go beyond 100, throws error
I was messing with the Vision Opacity setting in MapTool Preferences, and found a bug, I think.
I assumed that vision opacity was a percentage (i.e., the default value of 60 was "60% opaque" or "60% transparent"). However, I noticed that you can increase vision opacity beyond 100, so I thought, "Okay, maybe it's not. Wonder how high it goes?"
Somewhere north of 200, MapTool threw the following infinitely-looping error:
"java.lang.IllegalArgumentException: alpha value out of range"
I killed Java, but - unfortunately - on a restart, the error persists. I'm going to nuke the .maptool directory, see if that brings it back (I should hope so), but this strikes me as a bug (possibly a known one).
I assumed that vision opacity was a percentage (i.e., the default value of 60 was "60% opaque" or "60% transparent"). However, I noticed that you can increase vision opacity beyond 100, so I thought, "Okay, maybe it's not. Wonder how high it goes?"
Somewhere north of 200, MapTool threw the following infinitely-looping error:
"java.lang.IllegalArgumentException: alpha value out of range"
I killed Java, but - unfortunately - on a restart, the error persists. I'm going to nuke the .maptool directory, see if that brings it back (I should hope so), but this strikes me as a bug (possibly a known one).
Re: [1.3.b56] Vision Opacity can go beyond 100, throws error
Nope. Nuking the .maptool directory does not fix the error. Will try a fresh install from the zip file.
Edit: Hm. Not even that fixed it.
Edit: Hm. Not even that fixed it.
Re: [1.3.b56] Vision Opacity can go beyond 100, throws error
Okay. I can no longer run maptool on this computer. I have deleted .maptool, downloaded a new copy of the software, and rebooted my computer even. I get the same error when restarting maptool.
Now, I realize I'm using a way-old java (1.5.0_15), because this is my work machine and I can't update it, so this error may be specific to Java so old nobody but me will run into it.
However...anybody have any suggestions on how to get that opacity setting straightened out so I can restart MapTool?
Now, I realize I'm using a way-old java (1.5.0_15), because this is my work machine and I can't update it, so this error may be specific to Java so old nobody but me will run into it.
However...anybody have any suggestions on how to get that opacity setting straightened out so I can restart MapTool?
Re: [1.3.b56] Vision Opacity can go beyond 100, throws error
Look for a registry entry. Isn't that where preferences are saved on Windows machines?
Re: [1.3.b56] Vision Opacity can go beyond 100, throws error
Aha! That did it. Thank you!Azhrei wrote:Look for a registry entry. Isn't that where preferences are saved on Windows machines?
Okay, and as a quick note: the vision opacity was set at 842, according to the Windows Registry. I assume it should probably only go up to 100, but I don't know. I certainly won't mess with it again.
-
- Kobold
- Posts: 3
- Joined: Mon Jun 08, 2009 12:21 pm
Re: [1.3.b56] Vision Opacity can go beyond 100, throws error
I reply to the thread in the in the main MT forum, but I figure I should put it here, too. The error pops up when the value is set above 255, which is the maximum value of an unsigned byte. The setting needs to be properly validated.
Re: [1.3.b56] Vision Opacity can go beyond 100, throws error
Ah, I forgot about that other thread (heh) when it went from "what's the max?" to "whoa, my MapTool broke!"SCPRedMage wrote:I reply to the thread in the in the main MT forum, but I figure I should put it here, too. The error pops up when the value is set above 255, which is the maximum value of an unsigned byte. The setting needs to be properly validated.
I figured it was a validation error, although I wouldn't have come up with unsigned byte or anything of that nature. Given that, I wonder if it's supposed to be 0 - 100, or 0 - 255. But anyway, a bug, something to fix when convenient.
Re: [1.3.b56] Vision Opacity can go beyond 100, throws error
well, i'm trying to hunt this down, for fun and profit, well, mostly fun... since theres no profit in it for me
Re: [1.3.b56] Vision Opacity can go beyond 100, throws error
aku wrote:well, i'm trying to hunt this down, for fun and profit, well, mostly fun... since theres no profit in it for me
If my experience is representativee, the controls being used are sometimes the default "standard constructors" provided by the Abeille dialog editor. You can customize them by applying models (SpinnerModel, TableModel, etc.) to them to set certain characteristics.
Re: [1.3.b56] Vision Opacity can go beyond 100, throws error
well, you lost me there rumble (remember, you're dealing with the Theorist here )
but so far, i found where it's setting the preference (surprisingly, in appPreferences.java!), and i found this chunk
So, i'm thinking i add an if statement to verify that KEY_VISION_OVERLAY_OPACITY is <256 and then find some nifty error dialog to toss if it isnt... (since i dont like things not working for no apparent reason... or i could just append some text to it indicating that fact )
but so far, i found where it's setting the preference (surprisingly, in appPreferences.java!), and i found this chunk
Code: Select all
}
public static void setVisionOverlayOpacity(int size) {
prefs.putInt(KEY_VISION_OVERLAY_OPACITY, size);
}
public static int getVisionOverlayOpacity() {
return prefs.getInt(KEY_VISION_OVERLAY_OPACITY,
DEFAULT_VISION_OVERLAY_OPACITY);
}
Re: [1.3.b56] Vision Opacity can go beyond 100, throws error
The KEY_* variables are static final String members of the class, not numbers.aku wrote:So, i'm thinking i add an if statement to verify that KEY_VISION_OVERLAY_OPACITY is <256 and then find some nifty error dialog to toss if it isnt... (since i dont like things not working for no apparent reason... or i could just append some text to it indicating that fact )
It'll be the size parameter in the set method that you want to validate. And it's probably a good idea to also constrain the return value of the get method as well. Something like... if (size < 0) size = 0; if (size > 255) size = 255; to ensure it stays within a valid range.
As Rumble pointed out, the form that is displayed on the screen probably has the capability of attaching a validator to it so that it automatically prevents the value from going out of range. Check out the docs for the JSpinner constructor and the SpinnerModel interface for examples of how this works.
Also, for the purposes of displaying a message, check in MapTool.java for methods named showError, showConfirm, and so on. They display a message with an OK button and such and wait for a response. You can hard-code the string you give them during testing, but really you should add a new entry to i18n.properties and pass the string of the key instead. Check the AppActions.java and other places to see how the "show" methods are invoked.
Re: [1.3.b56] Vision Opacity can go beyond 100, throws error
i knew i saw that, somewhereAzhrei wrote:This i realized, when eclipe started to puke an error message about < not being aw valid opperator for stringsaku wrote:So, i'm thinking i add an if statement to verify that KEY_VISION_OVERLAY_OPACITY is <256 and then find some nifty error dialog to toss if it isnt... (since i dont like things not working for no apparent reason... or i could just append some text to it indicating that fact )
The KEY_* variables are static final String members of the class, not numbers.
It'll be the size parameter in the set method that you want to validate. And it's probably a good idea to also constrain the return value of the get method as well. Something like... if (size < 0) size = 0; if (size > 255) size = 255; to ensure it stays within a valid range.
As Rumble pointed out, the form that is displayed on the screen probably has the capability of attaching a validator to it so that it automatically prevents the value from going out of range. Check out the docs for the JSpinner constructor and the SpinnerModel interface for examples of how this works.
/scratches head
/talksToSelfAlso, for the purposes of displaying a message, check in MapTool.java for methods named showError, showConfirm, and so on. They display a message with an OK button and such and wait for a response. You can hard-code the string you give them during testing, but really you should add a new entry to i18n.properties and pass the string of the key instead. Check the AppActions.java and other places to see how the "show" methods are invoked.
Re: [1.3.b56] Vision Opacity can go beyond 100, throws error
Aku - look at PreferencesDialog.java. Line 443.
Re: [1.3.b56] Vision Opacity can go beyond 100, throws error
thanks for the nudge phergus! not sure what i'll find there but i'll find out when i get home tonight
Edit: shh, be wery, wery, quiet, i's be <kaboom!> er, dont worry bout this bug no more
now if only i can find the how to send trevor patches post... i guess i could go on another bug hunt, kinda pointless to just send one lousy patch with ~3 lines of code, heh
Edit: shh, be wery, wery, quiet, i's be <kaboom!> er, dont worry bout this bug no more
now if only i can find the how to send trevor patches post... i guess i could go on another bug hunt, kinda pointless to just send one lousy patch with ~3 lines of code, heh
Re: [1.3.b56] Vision Opacity can go beyond 100, throws error
Have you found this one yet? Be sure to read the whole thing, as the Source -> Format requires the proper settings in the Eclipse preferences to work properly.