{"record":{"id":"00b8b9dc2d2e2785","repo":"apache/hadoop","slug":"a-valid-name-must-be-specified","errorCode":null,"errorMessage":"A valid name must be specified.","messagePattern":"A valid name must be specified\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AzureBlobFileSystem.java","lineNumber":1171,"sourceCode":"  }\n\n  /**\n   * Get the value of an attribute for a non-root path.\n   *\n   * @param path The path on which to get the attribute\n   * @param name The attribute to get\n   * @return The bytes of the attribute's value (encoded in latin-1)\n   *         or null if the attribute does not exist\n   * @throws IOException If there was an issue getting the attribute from Azure\n   * @throws IllegalArgumentException If name is null or empty\n   */\n  @Override\n  public byte[] getXAttr(final Path path, final String name)\n      throws IOException {\n    LOG.debug(\"AzureBlobFileSystem.getXAttr path: {}\", path);\n\n    if (name == null || name.isEmpty()) {\n      throw new IllegalArgumentException(\"A valid name must be specified.\");\n    }\n\n    Path qualifiedPath = makeQualified(path);\n\n    byte[] value = null;\n    try {\n      TracingContext tracingContext = new TracingContext(clientCorrelationId,\n          fileSystemId, FSOperationType.GET_ATTR, true, tracingHeaderFormat,\n          listener);\n      Hashtable<String, String> properties = getAbfsStore()\n          .getPathStatus(qualifiedPath, tracingContext);\n      String xAttrName = ensureValidAttributeName(name);\n      if (properties.containsKey(xAttrName)) {\n        String xAttrValue = properties.get(xAttrName);\n        value = getAbfsStore().encodeAttribute(xAttrValue);\n      }\n    } catch (AzureBlobFileSystemException ex) {\n      checkException(path, ex);","sourceCodeStart":1153,"sourceCodeEnd":1189,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AzureBlobFileSystem.java#L1153-L1189","documentation":"Thrown by AzureBlobFileSystem.getXAttr when the requested attribute name is null or empty. The name is required to look up the corresponding path property on the service; the check fires before any request is sent. Unlike missing-attribute cases (which return null), an invalid name is a caller bug.","triggerScenarios":"Calling fs.getXAttr(path, null) or fs.getXAttr(path, \"\") — often from a name built by string concatenation or split that produced an empty result.","commonSituations":"Parsing xattr names from user input or config where a blank value slips through; looping over a names list that contains empty strings; porting code that assumed whitespace trimming.","solutions":["Validate the name is non-null and non-empty before calling getXAttr.","Trace where the empty name is produced (split/trim/concat logic) and fix the producer.","Use fs.getXAttrs(path) to list all attributes when the name is genuinely unknown."],"exampleFix":"// before\nbyte[] v = fs.getXAttr(path, namePart);\n\n// after\nif (namePart == null || namePart.isEmpty()) {\n  throw new IllegalArgumentException(\"xattr name required, got: \" + namePart);\n}\nbyte[] v = fs.getXAttr(path, namePart);","handlingStrategy":"validation","validationCode":"if (name == null || name.isEmpty()) {\n  return null; // or throw your own descriptive error\n}\nreturn fs.getXAttr(path, name);","typeGuard":"static boolean hasText(String s) {\n  return s != null && !s.isEmpty();\n}","tryCatchPattern":"try {\n  value = fs.getXAttr(path, name);\n} catch (IllegalArgumentException e) {\n  // invalid name is a programming error; fix the producer of the name\n}","preventionTips":["Validate names produced by split/concat/trim before use.","Prefer fs.getXAttrs(path) when enumerating instead of probing empty names.","Add unit tests for name-building logic with blank inputs."],"tags":["azure-abfs","getxattr","xattr","illegal-argument"],"backgroundTag":"missing-required-argument","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}