{"record":{"id":"8824c76cdc4c3aae","repo":"asLody/VirtualApp","slug":"accounttype-is-null-8824c7","errorCode":null,"errorMessage":"accountType is null","messagePattern":"accountType is null","errorType":"exception","errorClass":"java.lang.IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"VirtualApp/lib/src/main/java/com/lody/virtual/server/accounts/VAccountManagerService.java","lineNumber":126,"sourceCode":"\n\n    @Override\n    public AuthenticatorDescription[] getAuthenticatorTypes(int userId) {\n        synchronized (cache) {\n            AuthenticatorDescription[] descArray = new AuthenticatorDescription[cache.authenticators.size()];\n            int i = 0;\n            for (AuthenticatorInfo info : cache.authenticators.values()) {\n                descArray[i] = info.desc;\n                i++;\n            }\n            return descArray;\n        }\n    }\n\n    @Override\n    public void getAccountsByFeatures(int userId, IAccountManagerResponse response, String type, String[] features) {\n        if (response == null) throw new IllegalArgumentException(\"response is null\");\n        if (type == null) throw new IllegalArgumentException(\"accountType is null\");\n        AuthenticatorInfo info = getAuthenticatorInfo(type);\n        if (info == null) {\n            Bundle bundle = new Bundle();\n            bundle.putParcelableArray(AccountManager.KEY_ACCOUNTS, new Account[0]);\n            try {\n                response.onResult(bundle);\n            } catch (RemoteException e) {\n                e.printStackTrace();\n            }\n            return;\n        }\n\n        if (features == null || features.length == 0) {\n            Bundle bundle = new Bundle();\n            bundle.putParcelableArray(AccountManager.KEY_ACCOUNTS, getAccounts(userId, type));\n            try {\n                response.onResult(bundle);\n            } catch (RemoteException e) {","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/asLody/VirtualApp/blob/666fefcb5d3f39cc944001c3457c38ffd6544c87/VirtualApp/lib/src/main/java/com/lody/virtual/server/accounts/VAccountManagerService.java#L108-L144","documentation":"Thrown as an IllegalArgumentException at the top of getAccountsByFeatures when the caller passes a null account type. This is a generic boundary-validation guard: the service needs a concrete account type to resolve its registered authenticator via getAuthenticatorInfo and start a feature-matching session, so a null type makes the query meaningless. The input at fault is the 'type' parameter supplied by the IPC caller (e.g., AccountManager.getAccountsByTypeAndFeature invoked with a null type).","triggerScenarios":"Calling getAccountsByFeatures(userId, response, null, features) — typically from client code where the accountType was never set or was read from a null extra/bundle key.","commonSituations":"AccountManager request built without KEY_ACCOUNT_TYPE; missing intent extra; config parsing returned null for the authenticator type.","solutions":["Pass a non-null account type string matching a registered authenticator","Check the client bundle/extra (AccountManager.KEY_ACCOUNT_TYPE) is populated before the call","Default the type from the authenticator metadata instead of an unset variable"],"exampleFix":"// before\nString type = bundle.getString(AccountManager.KEY_ACCOUNT_TYPE); // null\nmService.getAccountsByFeatures(userId, response, type, features);\n// after\nString type = bundle.getString(AccountManager.KEY_ACCOUNT_TYPE);\nif (type == null) type = \"com.example.account\";\nmService.getAccountsByFeatures(userId, response, type, features);","handlingStrategy":"validation","validationCode":"if (type == null || type.isEmpty()) {\n    throw new IllegalArgumentException(\"accountType must be non-empty\");\n}\nmService.getAccountsByFeatures(userId, response, type, features);","typeGuard":null,"tryCatchPattern":"try {\n    mService.getAccountsByFeatures(userId, response, type, features);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"accountType is null\")) {\n        // read type from authenticator config or defaults before retrying\n    }\n}","preventionTips":["Always set AccountManager.KEY_ACCOUNT_TYPE in request bundles","Read account type from constants, not nullable extras","Validate inputs in a client-side wrapper around the service"],"tags":["android","accounts","null-argument","validation"],"backgroundTag":"null-argument","analyzedSha":"666fefcb5d3f39cc944001c3457c38ffd6544c87","analyzedAt":"2026-09-09T11:09:01.694Z","contentChangedAt":"2026-09-09T11:09:01.694Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}