{"record":{"id":"bb1e803f63185043","repo":"iflytek/astron-agent","slug":"database-table-illegal-default","errorCode":"DATABASE_TABLE_ILLEGAL_DEFAULT","errorMessage":"DATABASE_TABLE_ILLEGAL_DEFAULT","messagePattern":"DATABASE_TABLE_ILLEGAL_DEFAULT","errorType":"error_code","errorClass":"BusinessException","httpStatus":null,"severity":"error","filePath":"console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/database/DBTableExcelReadListener.java","lineNumber":87,"sourceCode":"    @Override\n    public void invoke(Map<Integer, String> row, AnalysisContext context) {\n        // Validate required fields are not empty\n        DbTableFieldDto dbTableFieldDto = new DbTableFieldDto();\n        if (row.get(0) == null || row.get(1) == null || row.get(2) == null || row.get(4) == null) {\n            throw new BusinessException(ResponseEnum.DATABASE_CANNOT_EMPTY);\n        }\n        dbTableFieldDto.setName(row.get(0));\n        if (!fieldType.contains(row.get(1))) {\n            throw new BusinessException(ResponseEnum.DATABASE_TYPE_ILLEGAL);\n        }\n        dbTableFieldDto.setType(row.get(1));\n        dbTableFieldDto.setDescription(row.get(2));\n        if (StringUtils.isNotBlank(row.get(3))) {\n            if (\"Integer\".equalsIgnoreCase(row.get(1))) {\n                try {\n                    Long.parseLong(row.get(3));\n                } catch (NumberFormatException e) {\n                    throw new BusinessException(ResponseEnum.DATABASE_TABLE_ILLEGAL_DEFAULT);\n                }\n            } else if (\"Boolean\".equalsIgnoreCase(row.get(1))) {\n                if (!\"true\".equalsIgnoreCase(row.get(3)) && !\"false\".equalsIgnoreCase(row.get(3))) {\n                    throw new BusinessException(ResponseEnum.DATABASE_TABLE_ILLEGAL_DEFAULT);\n                }\n            } else if (\"Number\".equalsIgnoreCase(row.get(1))) {\n                try {\n                    Double.parseDouble(row.get(3));\n                } catch (NumberFormatException e) {\n                    throw new BusinessException(ResponseEnum.DATABASE_TABLE_ILLEGAL_DEFAULT);\n                }\n            }\n        }\n        dbTableFieldDto.setDefaultValue(row.get(3));\n        dbTableFieldDto.setIsRequired(\"是\".equals(row.get(4)));\n        tableFields.add(dbTableFieldDto);\n    }\n","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/database/DBTableExcelReadListener.java#L69-L105","documentation":"DBTableExcelReadListener.invoke throws BusinessException(DATABASE_TABLE_ILLEGAL_DEFAULT) when a row's Default Value (column 3) is non-blank but the field type is Integer and the value cannot be parsed with Long.parseLong. Each type has a default-value format check; this is the Integer branch, triggered by NumberFormatException.","triggerScenarios":"An Integer-typed row has a default value like \"abc\", \"1.5\", \"12,000\", \"\", a value exceeding Long range, or any non-integer text.","commonSituations":"Users enter decimal or comma-formatted numbers as integer defaults; unit suffixes like \"100ms\"; large numbers beyond Long.MAX_VALUE.","solutions":["Change the default value to a plain integer literal within Long range, e.g. 0 or 42.","If the default genuinely needs a fraction, change the field type to Number (parsed with Double.parseDouble) instead of Integer.","Remove the default value entirely (leave column 3 blank) since Default Value is optional."],"exampleFix":"// before\n// count | Integer | hit count | 1.5 | 是 -> DATABASE_TABLE_ILLEGAL_DEFAULT\n// after\n// count | Integer | hit count | 0 | 是","handlingStrategy":"validation","validationCode":"// pre-flight: Integer default values must parse as a long\nif (\"Integer\".equalsIgnoreCase(row.get(1)) && row.get(3) != null && !row.get(3).isBlank()) {\n    try { Long.parseLong(row.get(3).trim()); }\n    catch (NumberFormatException e) { throw new IllegalArgumentException(\"Integer default must be a whole number: \" + row.get(3)); }\n}","typeGuard":null,"tryCatchPattern":"try {\n    EasyExcel.read(file, listener).sheet().doRead();\n} catch (BusinessException e) {\n    if (\"DATABASE_TABLE_ILLEGAL_DEFAULT\".equals(e.getCode())) {\n        // flag the Default Value cell of the Integer-typed row\n    }\n}","preventionTips":["Use whole-number literals (0, 42) for Integer defaults; no decimals, commas, or units.","Switch the field type to Number if the default needs a fraction.","Leave Default Value blank when unsure."],"tags":["excel","validation","integer","java"],"backgroundTag":"invalid-argument-format","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}