{"record":{"id":"213cd598c8e8987f","repo":"OtterMind/Chat2DB","slug":"common-paramdetailerror-213cd5","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/imports/ImportFactory.java","lineNumber":26,"sourceCode":"import ai.chat2db.community.domain.core.impl.task.imports.sql.SQLImporter;\n\nimport java.util.Map;\nimport java.util.Objects;\n\npublic class ImportFactory {\n\n    private static final Map<String, IImportStrategy> exports = Map.of(\n            \"xls\", new XLSImporter(),\n            \"xlsx\", new XLSXImporter(),\n            \"csv\", new CSVImporter(),\n            \"json\", new JSONImporter(),\n            \"sql\", new SQLImporter()\n    );\n\n    public static IImportStrategy get(String type) {\n        IImportStrategy dataExportStrategy = exports.get(type.toLowerCase());\n        if (Objects.isNull(dataExportStrategy)) {\n            throw new ParamBusinessException(type);\n        }\n        return dataExportStrategy;\n    }\n}\n","sourceCodeStart":8,"sourceCodeEnd":31,"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/imports/ImportFactory.java#L8-L31","documentation":"ParamBusinessException ('common.paramDetailError') from ImportFactory.get when the requested import type (lowercased) is not one of xls, xlsx, csv, json, sql — no IImportStrategy is registered.","triggerScenarios":"Calling ImportFactory.get with an unsupported/typo'd type string, or a format the importer set does not cover.","commonSituations":"Client selects a format not supported for import; typo in the type field; new format needed without a registered importer.","solutions":["Use one of the supported import types: xls, xlsx, csv, json, sql.","If a new format is required, implement IImportStrategy and add it to the exports map in ImportFactory.","Validate the type against the supported set before calling get."],"exampleFix":"// before\nIImportStrategy s = ImportFactory.get(\"xml\"); // throws\n// after\nIImportStrategy s = ImportFactory.get(\"sql\");\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 isSupportedImportType(String t) {\n    return t != null && java.util.Set.of(\"xls\",\"xlsx\",\"csv\",\"json\",\"sql\").contains(t.toLowerCase());\n}","tryCatchPattern":null,"preventionTips":["Constrain the import format selector to the registered set.","Register any new importer in ImportFactory before exposing it.","Normalize/lowercase the type before lookup."],"tags":["import","validation","factory","param"],"backgroundTag":null,"analyzedSha":"5ee1e990e73fbcae1969dc554be254fedb3ab888","analyzedAt":"2026-08-14T07:05:03.077Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}