{"record":{"id":"37c6547d976e6465","repo":"Konloch/bytecode-viewer","slug":"empty-value-not-valid","errorCode":null,"errorMessage":"Empty value not valid","messagePattern":"Empty value not valid","errorType":"validation","errorClass":"InputMismatchException","httpStatus":null,"severity":"info","filePath":"src/main/java/the/bytecode/club/bytecodeviewer/gui/hexviewer/ValuesPanel.java","lineNumber":603,"sourceCode":"                updateValues();\n            }\n            catch (NumberFormatException ex)\n            {\n                showException(ex);\n            }\n        }\n    }//GEN-LAST:event_doubleTextFieldKeyReleased\n\n    private void characterTextFieldKeyReleased(java.awt.event.KeyEvent evt)\n    {//GEN-FIRST:event_characterTextFieldKeyReleased\n        if (evt.getKeyCode() == KeyEvent.VK_ENTER && isEditable())\n        {\n            try\n            {\n                String characterText = characterTextField.getText();\n\n                if (characterText.length() == 0)\n                    throw new InputMismatchException(\"Empty value not valid\");\n\n                if (characterText.length() > 1)\n                    throw new InputMismatchException(\"Only single character allowed\");\n\n                byte[] bytes = characterText.getBytes(codeArea.getCharset());\n                System.arraycopy(bytes, 0, valuesCache, 0, bytes.length);\n\n                modifyValues(bytes.length);\n                updateValues();\n            }\n            catch (InputMismatchException ex)\n            {\n                showException(ex);\n            }\n        }\n    }//GEN-LAST:event_characterTextFieldKeyReleased\n\n    private void stringTextFieldKeyReleased(java.awt.event.KeyEvent evt)","sourceCodeStart":585,"sourceCodeEnd":621,"githubUrl":"https://github.com/Konloch/bytecode-viewer/blob/31430e0033fa220db566b5ef461256727ff6793b/src/main/java/the/bytecode/club/bytecodeviewer/gui/hexviewer/ValuesPanel.java#L585-L621","documentation":"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.","triggerScenarios":"characterTextFieldKeyReleased with characterText.length() == 0 — e.g. clearing the character field completely.","commonSituations":"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.","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."],"exampleFix":"// before\ncharacterTextField.setText(\"\"); // throws on next keyReleased\n// after\ncharacterTextField.setText(\"A\"); // exactly one character","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    applyCharacterValue(characterTextField.getText());\n} catch (InputMismatchException e) {\n    // field empty or multi-char; wait for valid input\n    setStatus(e.getMessage());\n}","preventionTips":["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."],"tags":["hexviewer","empty-input","gui","validation"],"backgroundTag":"empty-input-rejected","analyzedSha":"31430e0033fa220db566b5ef461256727ff6793b","analyzedAt":"2026-09-05T18:22:22.725Z","contentChangedAt":"2026-09-05T18:22:22.725Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}