{"record":{"id":"0de9b76c2ee7b83d","repo":"pinpoint-apm/pinpoint","slug":"fieldname","errorCode":null,"errorMessage":"${fieldName}","messagePattern":"\\$\\{fieldName\\}","errorType":"validation","errorClass":"NullPointerException","httpStatus":null,"severity":"error","filePath":"commons-server/src/main/java/com/navercorp/pinpoint/common/server/applicationmap/statistics/UidPrefix.java","lineNumber":101,"sourceCode":"\n        int secondTimestamp = IntInverter.restore(buffer.readInt());\n        long msTimestamp = SecondTimestamp.restoreSecondTimestamp(secondTimestamp);\n        return new UidPrefix(serviceUid, applicationNameHash, serviceType, msTimestamp);\n    }\n\n\n    public static int hash(byte[] bytes) {\n        HashCode hashCode = hashFunction.hashBytes(bytes);\n        return hashCode.hashCode();\n    }\n\n    public static String requireNameLength(String name, String fieldName) {\n        return requireNameLength(name, fieldName, KEY_SIZE);\n    }\n\n    public static String requireNameLength(String name, String fieldName, int maxKeySize) {\n        if (name == null) {\n            throw new NullPointerException(fieldName);\n        }\n        if (name.length() > maxKeySize) {\n            throw new IllegalArgumentException(fieldName + \" too long:\" + name.length());\n        }\n        return name;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (o == null || getClass() != o.getClass()) return false;\n\n        UidPrefix uidPrefix = (UidPrefix) o;\n        return serviceUid == uidPrefix.serviceUid && applicationNameHash == uidPrefix.applicationNameHash && serviceType == uidPrefix.serviceType && timestamp == uidPrefix.timestamp;\n    }\n\n    @Override\n    public int hashCode() {\n        int result = serviceUid;","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/pinpoint-apm/pinpoint/blob/744c3d3075e595656abb1ae331ad2c0e4c9eb996/commons-server/src/main/java/com/navercorp/pinpoint/common/server/applicationmap/statistics/UidPrefix.java#L83-L119","documentation":"UidPrefix.requireNameLength throws a NullPointerException whose message is the field name when the given name is null. It is a guard ensuring the name component of a UID prefix key is present before it is embedded into HBase row keys.","triggerScenarios":"Calling requireNameLength(name, fieldName) (or any UidPrefix API that delegates to it) with name == null, e.g. building a UidLink row key from an applicationName/serviceName that is null.","commonSituations":"Config or request missing the application/service name; a null returned by an upstream lookup used directly as the key name; deserialized metadata missing the field.","solutions":["Ensure the name (applicationName/serviceName) is non-null before constructing the row key","Check config/DTO population: a missing or empty config field often yields null here","Catch NullPointerException at the boundary and report the field name given in the message","Prefer explicitly validating inputs and throwing a descriptive exception before calling the key builder"],"exampleFix":"// before\nUidLinkRowKey key = new UidLinkRowKey(serviceUid, prefix.requireNameLength(appName, \"applicationName\"), ...);\n// after\nObjects.requireNonNull(appName, \"applicationName must not be null\");\nUidLinkRowKey key = new UidLinkRowKey(serviceUid, prefix.requireNameLength(appName, \"applicationName\"), ...);","handlingStrategy":"validation","validationCode":"String requireNonNullName(String name, String field) {\n    if (name == null) throw new IllegalArgumentException(field + \" must not be null\");\n    return name;\n}","typeGuard":"String requireNonNullName(String name, String field) {\n    if (name == null) throw new IllegalArgumentException(field + \" must not be null\");\n    return name;\n}","tryCatchPattern":"try {\n    String validated = UidPrefix.requireNameLength(name, \"applicationName\");\n} catch (NullPointerException e) {\n    log.error(\"missing {} for UID key construction\", e.getMessage());\n    // fail the request with a clear client-side validation message\n}","preventionTips":["Validate that applicationName/serviceName is set in config/DTOs before key construction","Avoid passing results of nullable lookups straight into row-key builders","Use Objects.requireNonNull with a descriptive message at API boundaries","Treat the NPE message as the field name to pinpoint the missing input"],"tags":["null-check","illegal-argument","rowkey"],"backgroundTag":"null-argument","analyzedSha":"744c3d3075e595656abb1ae331ad2c0e4c9eb996","analyzedAt":"2026-09-07T18:48:45.289Z","contentChangedAt":"2026-09-07T18:48:45.289Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}