{"record":{"id":"e2b2706e7b6bc368","repo":"theonedev/onedev","slug":"getter-not-found-class-s-property-s","errorCode":null,"errorMessage":"Getter not found (class: %s, property: %s)","messagePattern":"Getter not found \\(class: (.+?), property: (.+?)\\)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/util/BeanUtils.java","lineNumber":168,"sourceCode":"\t}\n\t\n\t/**\n\t * Find getter method by property name in specified class and super classes.\n\t * \n\t * @param clazz\n\t * \t\t\tclass to search getter method. All super classes will also be \n\t * \t\t\tsearched if not found in current class\n\t * @param propertyName\n\t * \t\t\tname of the property to search getter for\n\t * @return\n\t * \t\t\tgetter method\n\t * @throws\n\t * \t\t\tRuntimeException if not found in class hierarchy\n\t */\n\tpublic static Method getGetter(Class<?> clazz, String propertyName) {\n\t\tMethod getter = findGetter(clazz, propertyName);\n\t\tif (getter == null) {\n\t\t\tthrow new RuntimeException(String.format(\"Getter not found (class: %s, property: %s)\", clazz.getName(), propertyName));\n\t\t}\n\t\treturn getter;\n\t}\n\t\n\t/**\n\t * Find getter method by property name in specified class and super classes.\n\t * \n\t * @param clazz\n\t * \t\t\tclass to search getter method. All super classes will also be \n\t * \t\t\tsearched if not found in current class\n\t * @param propertyName\n\t * \t\t\tname of the property to search getter for\n\t * @return\n\t * \t\t\tgetter method, or <tt>null</tt> if not found in class hierarchy\n\t */\n\tpublic static Method findGetter(Class<?> clazz, String propertyName) {\n\t\tString methodSuffix = getAccessorSuffix(propertyName);\n\t\tMethod getter = ReflectionUtils.findMethod(clazz, \"get\" + methodSuffix);","sourceCodeStart":150,"sourceCodeEnd":186,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/util/BeanUtils.java#L150-L186","documentation":"BeanUtils.getGetter() resolves a JavaBean getter method for a property by walking the class hierarchy via findGetter(). If no getter exists for the given property name, it throws a RuntimeException naming the class and property. This is a programming/reflection error — code referenced a bean property that does not exist.","triggerScenarios":"Calling BeanUtils.getGetter(clazz, propertyName) where the class (and its superclasses) define no method matching the JavaBean getter convention for that property (missing getX()/isX(), wrong case, or property renamed).","commonSituations":"Renaming a bean field without updating string-based property references (query criteria, Wicket property models, YAML/setting keys); typos in property names; passing an interface/class different from the actual bean type.","solutions":["Check the exact property name and its capitalization against the bean class; add or fix the getter (getX()/isX())","Update all string references after refactoring — search the codebase for the old property name","Compile-time safety: prefer method references/constant property names over raw strings where possible","At runtime, validate property existence reflectively before use and fail fast with a clear message"],"exampleFix":"// before\nMethod m = BeanUtils.getGetter(PullRequest.class, \"tilte\"); // typo\n// after\nMethod m = BeanUtils.getGetter(PullRequest.class, \"title\"); // matches getTitle()","handlingStrategy":"validation","validationCode":"public static boolean hasGetter(Class<?> clazz, String prop) {\n    String cap = Character.toUpperCase(prop.charAt(0)) + prop.substring(1);\n    try {\n        clazz.getMethod(\"get\" + cap);\n        return true;\n    } catch (NoSuchMethodException e) {\n        try { clazz.getMethod(\"is\" + cap); return true; }\n        catch (NoSuchMethodException e2) { return false; }\n    }\n}","typeGuard":"if (hasGetter(PullRequest.class, \"title\")) {\n    Method m = BeanUtils.getGetter(PullRequest.class, \"title\");\n}","tryCatchPattern":"try {\n    Method m = BeanUtils.getGetter(clazz, property);\n} catch (RuntimeException e) {\n    if (e.getMessage().startsWith(\"Getter not found\"))\n        throw new ConfigurationException(\"Check property name against \" + clazz.getName(), e);\n    throw e;\n}","preventionTips":["Search for usages of a property string before renaming the field","Keep getter names strictly JavaBean-compliant","Prefer compile-checked property references over raw strings"],"tags":["reflection","javabeans","property-not-found","runtime"],"backgroundTag":"resource-not-found","analyzedSha":"d44925c47c37992c828ea673a5f9620539bc3ff2","analyzedAt":"2026-09-06T07:18:27.995Z","contentChangedAt":"2026-09-06T07:18:27.995Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}