{"record":{"id":"8288d868b0c53c60","repo":"apache/hadoop","slug":"permissions-must-not-be-null","errorCode":null,"errorMessage":"Permissions must not be null","messagePattern":"Permissions must not be null","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/Options.java","lineNumber":136,"sourceCode":"        }\n        bytesPerChecksum = bpc; \n      }\n      public int getValue() { return bytesPerChecksum; }\n    }\n\n    public static class ChecksumParam extends CreateOpts {\n      private final ChecksumOpt checksumOpt;\n      protected ChecksumParam(ChecksumOpt csumOpt) {\n        checksumOpt = csumOpt;\n      }\n      public ChecksumOpt getValue() { return checksumOpt; }\n    }\n    \n    public static class Perms extends CreateOpts {\n      private final FsPermission permissions;\n      protected Perms(FsPermission perm) { \n        if(perm == null) {\n          throw new IllegalArgumentException(\"Permissions must not be null\");\n        }\n        permissions = perm; \n      }\n      public FsPermission getValue() { return permissions; }\n    }\n    \n    public static class Progress extends CreateOpts {\n      private final Progressable progress;\n      protected Progress(Progressable prog) { \n        if(prog == null) {\n          throw new IllegalArgumentException(\"Progress must not be null\");\n        }\n        progress = prog;\n      }\n      public Progressable getValue() { return progress; }\n    }\n    \n    public static class CreateParent extends CreateOpts {","sourceCodeStart":118,"sourceCodeEnd":154,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/Options.java#L118-L154","documentation":"Options.CreateOpts.Perms (FileSystem.create(path, CreateOpts.perms(perm), ...)) requires a non-null FsPermission; null throws IllegalArgumentException immediately because the option object would otherwise carry no permission at all.","triggerScenarios":"CreateOpts.perms(null) or new CreateOpts.Perms(null) — commonly an optional permission parameter forwarded blindly from a helper method whose caller passed null.","commonSituations":"API wrappers with @Nullable permission parameters, config-driven permission code paths where the property is absent.","solutions":["Pass FsPermission.getFileDefault()/getDirDefault() (or an explicit umask-derived value) when the caller has no specific permission","Omit the Perms option entirely so the FileSystem default applies","Null-check optional parameters before building the opts array"],"exampleFix":"// before\nCreateOpts.perms(userPerm);            // userPerm == null\n// after\nCreateOpts.perms(userPerm != null ? userPerm : FsPermission.getFileDefault());","handlingStrategy":"validation","validationCode":"FsPermission perm = (permOpt != null) ? permOpt : FsPermission.getFileDefault();\nout = fs.create(p, CreateOpts.perms(perm));","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Substitute FsPermission.getFileDefault()/getDirDefault() for null","Omit the Perms option to use the FS default","Null-check optional parameters before building option arrays"],"tags":["create-options","permissions","null-argument","validation"],"backgroundTag":"null-create-option","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}