Use the original value in the error

This commit is contained in:
Lukas Rieger (Blue) 2023-02-07 11:09:08 +01:00
parent 8b16805515
commit 7d263c8b7f
No known key found for this signature in database
GPG Key ID: 2D09EC5ED2687FF2
2 changed files with 4 additions and 3 deletions

@ -1 +1 @@
Subproject commit f9bbdc3d38405f59a82f427b868d6d5f7545738e
Subproject commit 1d0d63f08853581a447f818fbacc7e5c14aa514e

View File

@ -170,13 +170,14 @@ public Color straight() {
* @return The parsed Integer
* @throws NumberFormatException If the value is not formatted correctly or if there is no value present.
*/
public Color parse(String val) {
public Color parse(String value) {
String val = value;
if (val.charAt(0) == '#') {
val = val.substring(1);
if (val.length() == 3) val = val + "f";
if (val.length() == 4) val = "" + val.charAt(0) + val.charAt(0) + val.charAt(1) + val.charAt(1) + val.charAt(2) + val.charAt(2) + val.charAt(3) + val.charAt(3);
if (val.length() == 6) val = val + "ff";
if (val.length() != 8) throw new NumberFormatException("Invalid color format: '" + val + "'!");
if (val.length() != 8) throw new NumberFormatException("Invalid color format: '" + value + "'!");
val = val.substring(6, 8) + val.substring(0, 6); // move alpha to front
return set(Integer.parseUnsignedInt(val, 16));
}