Konloch/bytecode-viewer · info · InputMismatchException
Empty value not valid
Error message
Empty value not valid
What it means
The character field handler throws InputMismatchException("Empty value not valid") when the text field is empty at key release, because there is no character to encode into the values cache. It is an immediate-validation guard, not a runtime failure.
Source
Thrown at src/main/java/the/bytecode/club/bytecodeviewer/gui/hexviewer/ValuesPanel.java:603
updateValues();
}
catch (NumberFormatException ex)
{
showException(ex);
}
}
}//GEN-LAST:event_doubleTextFieldKeyReleased
private void characterTextFieldKeyReleased(java.awt.event.KeyEvent evt)
{//GEN-FIRST:event_characterTextFieldKeyReleased
if (evt.getKeyCode() == KeyEvent.VK_ENTER && isEditable())
{
try
{
String characterText = characterTextField.getText();
if (characterText.length() == 0)
throw new InputMismatchException("Empty value not valid");
if (characterText.length() > 1)
throw new InputMismatchException("Only single character allowed");
byte[] bytes = characterText.getBytes(codeArea.getCharset());
System.arraycopy(bytes, 0, valuesCache, 0, bytes.length);
modifyValues(bytes.length);
updateValues();
}
catch (InputMismatchException ex)
{
showException(ex);
}
}
}//GEN-LAST:event_characterTextFieldKeyReleased
private void stringTextFieldKeyReleased(java.awt.event.KeyEvent evt)View on GitHub (pinned to 31430e0033)
Solutions
- Type exactly one character into the field.
- If you want to clear the bytes, use the hex editor's clear/undo functions instead of emptying the field.
- Ignore the message until a character is present; it is non-destructive validation feedback.
Example fix
// before
characterTextField.setText(""); // throws on next keyReleased
// after
characterTextField.setText("A"); // exactly one character Defensive patterns
Strategy: validation
Try / catch
try {
applyCharacterValue(characterTextField.getText());
} catch (InputMismatchException e) {
// field empty or multi-char; wait for valid input
setStatus(e.getMessage());
} Prevention
- Only process the field when it contains exactly one character.
- Ignore empty-field key events as a normal transient state.
- Use the hex editor's clear function to reset bytes, not field deletion.
When it happens
Trigger: characterTextFieldKeyReleased with characterText.length() == 0 — e.g. clearing the character field completely.
Common situations: Deleting the character with backspace and continuing to type/press keys; clearing the field expecting the hex view to reset; focus/key events firing after the text was emptied.
Related errors
AI-assisted analysis of Konloch/bytecode-viewer@31430e0033 (2026-09-05).
Data as JSON: /api/errors/37c6547d976e6465.
Report an issue: GitHub.