Konloch/bytecode-viewer · warning · NumberFormatException
Value out of range
Error message
Value out of range
What it means
Same int-field range guard as error 20: the keyReleased handler throws NumberFormatException(VALUE_OUT_OF_RANGE) when the parsed long falls outside the 32-bit signed or unsigned bounds. Both branches (signed and unsigned) of the check produce this message.
Source
Thrown at src/main/java/the/bytecode/club/bytecodeviewer/gui/hexviewer/ValuesPanel.java:461
}
}//GEN-LAST:event_wordTextFieldKeyReleased
private void intTextFieldKeyReleased(java.awt.event.KeyEvent evt)
{//GEN-FIRST:event_intTextFieldKeyReleased
if (evt.getKeyCode() == KeyEvent.VK_ENTER && isEditable())
{
try
{
long longValue = Long.parseLong(intTextField.getText());
if (isSigned())
{
if (longValue < Integer.MIN_VALUE || longValue > Integer.MAX_VALUE)
throw new NumberFormatException(VALUE_OUT_OF_RANGE);
}
else
{
if (longValue < 0 || longValue > UINT_MAX_VALUE)
throw new NumberFormatException(VALUE_OUT_OF_RANGE);
}
if (getByteOrder() == ByteOrder.LITTLE_ENDIAN)
{
valuesCache[0] = (byte) (longValue & 0xff);
valuesCache[1] = (byte) ((longValue >> 8) & 0xff);
valuesCache[2] = (byte) ((longValue >> 16) & 0xff);
valuesCache[3] = (byte) ((longValue >> 24) & 0xff);
}
else
{
valuesCache[0] = (byte) ((longValue >> 24) & 0xff);
valuesCache[1] = (byte) ((longValue >> 16) & 0xff);
valuesCache[2] = (byte) ((longValue >> 8) & 0xff);
valuesCache[3] = (byte) (longValue & 0xff);
}
modifyValues(4);View on GitHub (pinned to 31430e0033)
Solutions
- Keep the value inside the mode's bounds before releasing the key.
- Switch the panel to unsigned mode for values up to 4294967295, or signed mode for negative values.
- Use the long field for anything wider than 32 bits.
- Clear and re-enter the value if stale text is the cause.
Example fix
// before (signed mode)
intTextField.setText("-5"); // throws in unsigned mode
// after
intTextField.setText("0"); // unsigned mode forbids negatives; use signed mode for -5 Defensive patterns
Strategy: validation
Validate before calling
long v = Long.parseLong(text.trim());
if (v < Integer.MIN_VALUE || v > Integer.MAX_VALUE)
throw new IllegalArgumentException("signed int out of range: " + v);
if (!signed && (v < 0 || v > 0xFFFFFFFFL))
throw new IllegalArgumentException("unsigned int out of range: " + v); Try / catch
try {
applyIntValue(text);
} catch (NumberFormatException e) {
LOGGER.warning("int value rejected: " + e.getMessage());
revertFieldValue();
} Prevention
- Check the signed/unsigned mode before typing negative or large values.
- Clamp or reject input in a DocumentFilter as the user types.
- Use the long field for anything outside 32-bit range.
- Re-validate pasted text explicitly before committing.
When it happens
Trigger: intTextFieldKeyReleased parses a long that is below Integer.MIN_VALUE / above Integer.MAX_VALUE (signed) or below 0 / above UINT_MAX_VALUE (unsigned).
Common situations: Typing 2147483648..4294967295 while the panel is in signed mode; typing negative numbers in unsigned mode; pasting hex-ish decimal values sized for a long.
Related errors
- Empty value not valid
- Only single character allowed
- '${codebase}' is not a directory
- String is too long
AI-assisted analysis of Konloch/bytecode-viewer@31430e0033 (2026-09-05).
Data as JSON: /api/errors/646eb35b4ddfd291.
Report an issue: GitHub.