{"record":{"id":"31ce3fcf226caef5","repo":"asLody/VirtualApp","slug":"features-is-null","errorCode":null,"errorMessage":"features is null","messagePattern":"features 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":378,"sourceCode":"    public void setUserData(int userId, Account account, String key, String value) {\n        if (key == null) throw new IllegalArgumentException(\"key is null\");\n        if (account == null) throw new IllegalArgumentException(\"account is null\");\n        VAccount vAccount = getAccount(userId, account);\n        if (vAccount != null) {\n            synchronized (accountsByUserId) {\n                vAccount.userDatas.put(key, value);\n                saveAllAccounts();\n            }\n        }\n    }\n\n\n    @Override\n    public void hasFeatures(int userId, IAccountManagerResponse response,\n                            final Account account, final String[] features) {\n        if (response == null) throw new IllegalArgumentException(\"response is null\");\n        if (account == null) throw new IllegalArgumentException(\"account is null\");\n        if (features == null) throw new IllegalArgumentException(\"features is null\");\n        AuthenticatorInfo info = this.getAuthenticatorInfo(account.type);\n        if (info == null) {\n            try {\n                response.onError(ERROR_CODE_BAD_ARGUMENTS, \"account.type does not exist\");\n            } catch (RemoteException e) {\n                e.printStackTrace();\n            }\n            return;\n        }\n        new Session(response, userId, info, false, true, account.name) {\n\n            @Override\n            public void run() throws RemoteException {\n                try {\n                    mAuthenticator.hasFeatures(this, account, features);\n                } catch (RemoteException e) {\n                    onError(AccountManager.ERROR_CODE_REMOTE_EXCEPTION, \"remote exception\");\n                }","sourceCodeStart":360,"sourceCodeEnd":396,"githubUrl":"https://github.com/asLody/VirtualApp/blob/666fefcb5d3f39cc944001c3457c38ffd6544c87/VirtualApp/lib/src/main/java/com/lody/virtual/server/accounts/VAccountManagerService.java#L360-L396","documentation":"hasFeatures(userId, response, account, features) throws IllegalArgumentException('features is null') as its third guard. The features array is required to determine whether the account's authenticator supports all requested capabilities; the downstream feature-check session cannot run without it.","triggerScenarios":"Calling hasFeatures with a null features array — typically a String[] built from a Bundle or preferences that was never populated, or an API wrapper forwarding an uninitialized array.","commonSituations":"Probing for features like 'service_xmpp' where the feature list comes from server config that failed to load; passing null intending 'no features' instead of an empty array.","solutions":["Pass an empty array (new String[0]) instead of null when no features are required","Validate the feature list source (config/Bundle) before calling","Guard: check response, account, and features all non-null before invoking hasFeatures"],"exampleFix":"// before\nservice.hasFeatures(userId, response, account, features); // features == null\n// after\nif (features == null) features = new String[0];\nservice.hasFeatures(userId, response, account, features);","handlingStrategy":"validation","validationCode":"if (features == null) { features = new String[0]; }","typeGuard":"String[] safeFeatures(String[] f) { return f == null ? new String[0] : f; }","tryCatchPattern":null,"preventionTips":["Use empty arrays, never null, to mean 'no features'","Validate feature lists loaded from config/server before calling","Wrap feature probes in a helper that normalizes null inputs"],"tags":["android","accounts","features","null-argument"],"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"}