{"record":{"id":"2935f30e380dcd3f","repo":"OtterMind/Chat2DB","slug":"common-paramdetailerror","errorCode":"common.paramDetailError","errorMessage":"common.paramDetailError","messagePattern":"common\\.paramDetailError","errorType":"exception","errorClass":"ParamBusinessException","httpStatus":null,"severity":"warning","filePath":"chat2db-community-server/chat2db-community-domain/chat2db-community-domain-core/src/main/java/ai/chat2db/community/domain/core/impl/task/export/ExportFactory.java","lineNumber":25,"sourceCode":"import ai.chat2db.community.domain.core.impl.task.export.json.JsonDataExporter;\nimport ai.chat2db.community.domain.core.impl.task.export.sql.SqlDataExporter;\n\nimport java.util.Map;\nimport java.util.Objects;\n\npublic class ExportFactory {\n    private static final Map<String, IExportStrategy> exports = Map.of(\n            \"xls\", new XlsDataExporter(),\n            \"xlsx\", new XlsxDataExporter(),\n            \"csv\", new CsvDataExporter(),\n            \"json\", new JsonDataExporter(),\n            \"sql\", new SqlDataExporter()\n    );\n\n    public static IExportStrategy getExporter(String type) {\n        IExportStrategy dataExportStrategy = exports.get(type.toLowerCase());\n        if (Objects.isNull(dataExportStrategy)) {\n            throw new ParamBusinessException(type);\n        }\n        return dataExportStrategy;\n    }\n\n\n}\n","sourceCodeStart":7,"sourceCodeEnd":32,"githubUrl":"https://github.com/OtterMind/Chat2DB/blob/5ee1e990e73fbcae1969dc554be254fedb3ab888/chat2db-community-server/chat2db-community-domain/chat2db-community-domain-core/src/main/java/ai/chat2db/community/domain/core/impl/task/export/ExportFactory.java#L7-L32","documentation":"ParamBusinessException ('common.paramDetailError') from ExportFactory.getExporter when the requested export type (lowercased) is not one of xls, xlsx, csv, json, sql — no IExportStrategy is registered for it.","triggerScenarios":"Calling getExporter with an unsupported/typo'd type string (e.g. 'xl', 'xml', 'tsv', null after toLowerCase via NPE, or an empty string).","commonSituations":"Frontend sends a format the backend doesn't ship; typo in the format selector; new format requested without registering a strategy.","solutions":["Use one of the supported types: xls, xlsx, csv, json, sql.","If a new format is needed, implement IExportStrategy and add it to the exports map in ExportFactory.","Validate the type client-side against the supported set before submitting."],"exampleFix":"// before\nIExportStrategy s = ExportFactory.getExporter(\"xml\"); // throws\n// after\nIExportStrategy s = ExportFactory.getExporter(\"csv\");\n","handlingStrategy":"type-guard","validationCode":"java.util.Set<String> supported = java.util.Set.of(\"xls\",\"xlsx\",\"csv\",\"json\",\"sql\");\nif (type == null || !supported.contains(type.toLowerCase())) throw new ParamBusinessException(type);","typeGuard":"boolean isSupportedExportType(String t) {\n    return t != null && java.util.Set.of(\"xls\",\"xlsx\",\"csv\",\"json\",\"sql\").contains(t.toLowerCase());\n}","tryCatchPattern":null,"preventionTips":["Constrain the format selector client-side to the registered set.","Register any new format strategy in ExportFactory before exposing it.","Normalize and lowercase the type before lookup."],"tags":["export","validation","factory","param"],"backgroundTag":null,"analyzedSha":"5ee1e990e73fbcae1969dc554be254fedb3ab888","analyzedAt":"2026-08-14T07:05:03.077Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}