{"record":{"id":"646eb35b4ddfd291","repo":"Konloch/bytecode-viewer","slug":"value-out-of-range","errorCode":null,"errorMessage":"Value out of range","messagePattern":"Value out of range","errorType":"validation","errorClass":"NumberFormatException","httpStatus":null,"severity":"warning","filePath":"src/main/java/the/bytecode/club/bytecodeviewer/gui/hexviewer/ValuesPanel.java","lineNumber":461,"sourceCode":"        }\n    }//GEN-LAST:event_wordTextFieldKeyReleased\n\n    private void intTextFieldKeyReleased(java.awt.event.KeyEvent evt)\n    {//GEN-FIRST:event_intTextFieldKeyReleased\n        if (evt.getKeyCode() == KeyEvent.VK_ENTER && isEditable())\n        {\n            try\n            {\n                long longValue = Long.parseLong(intTextField.getText());\n                if (isSigned())\n                {\n                    if (longValue < Integer.MIN_VALUE || longValue > Integer.MAX_VALUE)\n                        throw new NumberFormatException(VALUE_OUT_OF_RANGE);\n                }\n                else\n                {\n                    if (longValue < 0 || longValue > UINT_MAX_VALUE)\n                        throw new NumberFormatException(VALUE_OUT_OF_RANGE);\n                }\n\n                if (getByteOrder() == ByteOrder.LITTLE_ENDIAN)\n                {\n                    valuesCache[0] = (byte) (longValue & 0xff);\n                    valuesCache[1] = (byte) ((longValue >> 8) & 0xff);\n                    valuesCache[2] = (byte) ((longValue >> 16) & 0xff);\n                    valuesCache[3] = (byte) ((longValue >> 24) & 0xff);\n                }\n                else\n                {\n                    valuesCache[0] = (byte) ((longValue >> 24) & 0xff);\n                    valuesCache[1] = (byte) ((longValue >> 16) & 0xff);\n                    valuesCache[2] = (byte) ((longValue >> 8) & 0xff);\n                    valuesCache[3] = (byte) (longValue & 0xff);\n                }\n\n                modifyValues(4);","sourceCodeStart":443,"sourceCodeEnd":479,"githubUrl":"https://github.com/Konloch/bytecode-viewer/blob/31430e0033fa220db566b5ef461256727ff6793b/src/main/java/the/bytecode/club/bytecodeviewer/gui/hexviewer/ValuesPanel.java#L443-L479","documentation":"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.","triggerScenarios":"intTextFieldKeyReleased parses a long that is below Integer.MIN_VALUE / above Integer.MAX_VALUE (signed) or below 0 / above UINT_MAX_VALUE (unsigned).","commonSituations":"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.","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."],"exampleFix":"// before (signed mode)\nintTextField.setText(\"-5\"); // throws in unsigned mode\n// after\nintTextField.setText(\"0\"); // unsigned mode forbids negatives; use signed mode for -5","handlingStrategy":"validation","validationCode":"long v = Long.parseLong(text.trim());\nif (v < Integer.MIN_VALUE || v > Integer.MAX_VALUE)\n    throw new IllegalArgumentException(\"signed int out of range: \" + v);\nif (!signed && (v < 0 || v > 0xFFFFFFFFL))\n    throw new IllegalArgumentException(\"unsigned int out of range: \" + v);","typeGuard":null,"tryCatchPattern":"try {\n    applyIntValue(text);\n} catch (NumberFormatException e) {\n    LOGGER.warning(\"int value rejected: \" + e.getMessage());\n    revertFieldValue();\n}","preventionTips":["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."],"tags":["hexviewer","range-check","gui","input-validation"],"backgroundTag":"integer-out-of-range","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"}