{"record":{"id":"64c81143003cd018","repo":"apache/hadoop","slug":"absolutepath-no-such-file-or-directory","errorCode":null,"errorMessage":"absolutePath + \": No such file or directory.\"","messagePattern":"absolutePath \\+ \": No such file or directory\\.\"","errorType":"exception","errorClass":"FileNotFoundException","httpStatus":null,"severity":"error","filePath":"hadoop-cloud-storage-project/hadoop-bos/src/main/java/org/apache/hadoop/fs/bos/BaiduBosFileSystem.java","lineNumber":329,"sourceCode":"    Path absolutePath = makeAbsolute(f);\n    String key = pathToKey(absolutePath);\n    if (key.isEmpty()) {\n      return newDirectory(null, absolutePath);\n    }\n\n    try {\n      FileMetadata meta = store.retrieveMetadata(key);\n      if (meta != null) {\n        if (meta.isFolder()) {\n          return meta.getLastModified() == 0\n              ? newDirectory(null, absolutePath)\n              : newDirectory(meta, absolutePath);\n        } else {\n          return newFile(meta, absolutePath);\n        }\n      }\n    } catch (FileNotFoundException e) {\n      throw new FileNotFoundException(\n          absolutePath + \": No such file or directory.\");\n    } catch (IOException e) {\n      LOG.error(\"bos-fs getFileStatus error: \", e);\n      throw e;\n    }\n    throw new FileNotFoundException(\n        absolutePath + \": No such file or directory.\");\n  }\n\n  @Override\n  public FileChecksum getFileChecksum(Path f, long length)\n      throws IOException {\n    LOG.debug(\"call the checksum for the path: {}\",\n        f.getName());\n    Path absolutePath = makeAbsolute(f);\n    String key = pathToKey(absolutePath);\n    return this.store.getFileChecksum(key);\n  }","sourceCodeStart":311,"sourceCodeEnd":347,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-cloud-storage-project/hadoop-bos/src/main/java/org/apache/hadoop/fs/bos/BaiduBosFileSystem.java#L311-L347","documentation":"TypedBytesOutput.write(Object) serializes a Java object by runtime instanceof dispatch: Byte through String, ArrayList as VECTOR, any List as LIST, and Map as MAP are supported; everything else falls into the final else and throws RuntimeException 'cannot write objects of this type'. The library throws it because typed bytes has no wire code for the object's type, so writing it would corrupt the stream.","triggerScenarios":"Passing objects outside the supported set to write(), or to a writer layered on it (typed-bytes streaming output, TypedBytesRecordWriter): e.g. java.util.Date, custom POJOs, arrays (String[]/byte[] as Object), BigDecimal, LinkedList/HashMap are fine (List/Map) but Set, Object[] and boxed short are not.","commonSituations":"Streaming mapper/reducer scripts (Python/Ruby) emitting values that get boxed into unsupported types; Java code copying arbitrary Writables through typed bytes; upgrading a pipeline from text keys to complex Java objects without converting them first.","solutions":["Convert before writing: POJO -> String (writeString), binary -> byte[] passed to writeBytes, numbers -> supported boxed types, sequences -> ArrayList/HashMap.","If you need arbitrary Hadoop Writable objects, use the WRITABLE code path (writeWritable) instead of write(Object).","For custom classes, serialize to bytes yourself and emit with the application-specific code range via writeBytes (codes 50-200).","Add a pre-submit unit test that round-trips every object type your job writes through TypedBytesOutput/TypedBytesInput."],"exampleFix":"// before\ntOut.write(myPojo);                 // RuntimeException: unsupported type\ntOut.write(new String[]{\"a\",\"b\"});  // arrays unsupported\n\n// after\ntOut.writeString(myPojo.toString());\njava.util.List<String> l = java.util.Arrays.asList(\"a\",\"b\");\ntOut.write(new java.util.ArrayList<>(l)); // ArrayList -> VECTOR","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"static boolean typedBytesWritable(Object o) {\n  return o == null\n      || o instanceof Byte || o instanceof Boolean || o instanceof Integer\n      || o instanceof Long || o instanceof Short && false // Short unsupported\n      || o instanceof Float || o instanceof Double\n      || o instanceof String || o instanceof byte[] == false // byte[] NOT supported by write()\n      || o instanceof ArrayList || o instanceof List || o instanceof Map;\n}","tryCatchPattern":"try {\n  tOut.write(obj);\n} catch (RuntimeException e) {\n  if (\"cannot write objects of this type\".equals(e.getMessage())) {\n    tOut.writeString(String.valueOf(obj)); // safe fallback encoding\n  } else throw e;\n}","preventionTips":["Convert POJOs/arrays/sets to String, byte[]-via-writeBytes, ArrayList or HashMap before write().","Use writeWritable() for arbitrary Writable objects.","Round-trip unit test every emitted type through TypedBytesOutput/TypedBytesInput."],"tags":["hadoop","typedbytes","serialization","unsupported-type"],"backgroundTag":"unsupported-type-serialization","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}