{"record":{"id":"69ca40ea5786be8a","repo":"apache/hadoop","slug":"incorrectly-formatted-line-s","errorCode":null,"errorMessage":"Incorrectly formatted line '%s'","messagePattern":"Incorrectly formatted line '(.+?)'","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/NfsExports.java","lineNumber":374,"sourceCode":"   * \"client-hosts [access-privilege]\"\n   */\n  private static Match getMatch(String line) {\n    String[] parts = line.split(\"\\\\s+\");\n    final String host;\n    AccessPrivilege privilege = AccessPrivilege.READ_ONLY;\n    switch (parts.length) {\n    case 1:\n      host = StringUtils.toLowerCase(parts[0]).trim();\n      break;\n    case 2:\n      host = StringUtils.toLowerCase(parts[0]).trim();\n      String option = parts[1].trim();\n      if (\"rw\".equalsIgnoreCase(option)) {\n        privilege = AccessPrivilege.READ_WRITE;\n      }\n      break;\n    default:\n      throw new IllegalArgumentException(\"Incorrectly formatted line '\" + line\n          + \"'\");\n    }\n    if (host.equals(\"*\")) {\n      if (LOG.isDebugEnabled()) {\n        LOG.debug(\"Using match all for '\" + host + \"' and \" + privilege);\n      }\n      return new AnonymousMatch(privilege);\n    } else if (CIDR_FORMAT_SHORT.matcher(host).matches()) {\n      if (LOG.isDebugEnabled()) {\n        LOG.debug(\"Using CIDR match for '\" + host + \"' and \" + privilege);\n      }\n      return new CIDRMatch(privilege, new SubnetUtils(host).getInfo());\n    } else if (CIDR_FORMAT_LONG.matcher(host).matches()) {\n      if (LOG.isDebugEnabled()) {\n        LOG.debug(\"Using CIDR match for '\" + host + \"' and \" + privilege);\n      }\n      String[] pair = host.split(\"/\");\n      return new CIDRMatch(privilege,","sourceCodeStart":356,"sourceCodeEnd":392,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/NfsExports.java#L356-L392","documentation":"hadoop-nfs NfsExports parses each exports line by splitting on whitespace (line.split(\"\\\\s+\")); an entry may contain at most two tokens: 'client-hosts' and an optional access privilege ('rw'). A line yielding three or more tokens throws IllegalArgumentException naming the offending line.","triggerScenarios":"An nfs.exports entry like \"192.168.0.0/24 rw sync\" or \"host rw ro\" — classic NFS mount options (sync, no_root_squash, insecure) are not part of this format and become a third token.","commonSituations":"Copying entries verbatim from /etc/exports of a real NFS server into the Hadoop NFS gateway's nfs.exports file/property; appending same-line comments; listing multiple options separated by spaces.","solutions":["Reduce each entry to one or two tokens: \"host\" or \"host rw\" (read-only is the default; any second token other than rw still means read-only)","Remove standard NFS options like sync, no_root_squash, insecure — the gateway format does not support them","Put comments on separate lines rather than appended after an entry"],"exampleFix":"# before (nfs.exports)\n192.168.0.0/24 rw sync no_root_squash\n\n# after\n192.168.0.0/24 rw","handlingStrategy":"validation","validationCode":"private static final Pattern ENTRY = Pattern.compile(\"^\\\\S+(\\\\s+(rw|ro))?$\");\n\nfor (String line : lines) {\n  if (!ENTRY.matcher(line).matches()) {\n    throw new IllegalArgumentException(\"Bad nfs.exports entry (max 2 tokens): \" + line);\n  }\n}\nNfsExports.getInstance(matchHosts, cacheSize);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep nfs.exports entries to 'host' or 'host rw' only","Do not copy full /etc/exports lines with sync/no_root_squash style options into the gateway config","Validate the exports file in a config lint step or unit test before deploying"],"tags":["nfs","configuration","exports","parse-error"],"backgroundTag":"config-parse-error","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}