{"record":{"id":"1c058f9b556cef16","repo":"beemdevelopment/Aegis","slug":"digits-is-not-an-integer","errorCode":null,"errorMessage":"Digits is not an integer.","messagePattern":"Digits is not an integer\\.","errorType":"validation","errorClass":"ParseException","httpStatus":null,"severity":"error","filePath":"app/src/main/java/com/beemdevelopment/aegis/ui/EditEntryActivity.java","lineNumber":740,"sourceCode":"        String type = _dropdownType.getText().toString();\n        String algo = _dropdownAlgo.getText().toString();\n        String lowerCasedType = type.toLowerCase(Locale.ROOT);\n\n        if (lowerCasedType.equals(YandexInfo.ID) || lowerCasedType.equals(MotpInfo.ID)) {\n            int pinLength = _textPin.length();\n            if (pinLength < 4) {\n                throw new ParseException(\"PIN is a required field. Must have a minimum length of 4 digits.\");\n            }\n            if (pinLength != 4 && lowerCasedType.equals(MotpInfo.ID)) {\n                throw new ParseException(\"PIN must have a length of 4 digits.\");\n            }\n        }\n\n        int digits;\n        try {\n            digits = Integer.parseInt(_textDigits.getText().toString());\n        } catch (NumberFormatException e) {\n            throw new ParseException(\"Digits is not an integer.\");\n        }\n\n        byte[] secret;\n        try {\n            String secretString = new String(EditTextHelper.getEditTextChars(_textSecret));\n\n            secret = (lowerCasedType.equals(MotpInfo.ID)) ?\n                    Hex.decode(secretString) : GoogleAuthInfo.parseSecret(secretString);\n\n            if (secret.length == 0) {\n                throw new ParseException(\"Secret cannot be empty\");\n            }\n        } catch (EncodingException e) {\n            String exceptionMessage = (lowerCasedType.equals(MotpInfo.ID)) ?\n                    \"Secret is not valid hexadecimal\" : \"Secret is not valid base32.\";\n\n            throw new ParseException(exceptionMessage);\n        }","sourceCodeStart":722,"sourceCodeEnd":758,"githubUrl":"https://github.com/beemdevelopment/Aegis/blob/d6f4e5925a97e4e91593f1542085eae03432a759/app/src/main/java/com/beemdevelopment/aegis/ui/EditEntryActivity.java#L722-L758","documentation":"EditEntryActivity.parseEntry() parses the digits field with Integer.parseInt and wraps NumberFormatException in a ParseException. Aegis throws this when the number-of-digits field for the OTP code is empty or non-numeric, because the code length must be an integer to configure the OtpInfo.","triggerScenarios":"Saving an entry while the 'Digits' text field is empty, contains letters, decimal values like '6.0', or whitespace; Integer.parseInt throws NumberFormatException.","commonSituations":"Users experimenting with advanced settings clearing the digits field, or pasting values such as 'six' or '6 ' into it.","solutions":["Enter a plain integer (commonly 6 or 8) in the Digits field before saving","Retype the value to remove stray whitespace or hidden characters","Restore the provider's documented code length (usually 6)"],"exampleFix":"// before\ndigitsField.setText(\"6.0\");\n// after\ndigitsField.setText(\"6\");","handlingStrategy":"validation","validationCode":"String digits = _textDigits.getText().toString().trim();\nif (!digits.matches(\"\\\\d+\")) {\n    _textDigitsLayout.setError(\"Enter a whole number\");\n    return;\n}","typeGuard":null,"tryCatchPattern":"try {\n    saveEntry();\n} catch (ParseException e) {\n    if (\"Digits is not an integer.\".equals(e.getMessage())) {\n        _textDigitsLayout.setError(\"Digits must be a whole number\");\n    }\n}","preventionTips":["Use inputType=\"number\" for the digits field","Pre-fill the field with the provider default (6) so it is never empty","Reject non-numeric input via InputFilter"],"tags":["android","validation","otp","input-parsing"],"backgroundTag":"invalid-argument-format","analyzedSha":"d6f4e5925a97e4e91593f1542085eae03432a759","analyzedAt":"2026-09-08T00:46:31.111Z","contentChangedAt":"2026-09-08T00:46:31.111Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}