{"record":{"id":"49fb4f8b0ba08d4d","repo":"mybatis/mybatis-3","slug":"error-parsing-property-name-didn-t-start-wi","errorCode":null,"errorMessage":"Error parsing property name '{}'.  Didn't start with 'is', 'get' or 'set'.","messagePattern":"Error parsing property name '(.+?)'\\.  Didn't start with 'is', 'get' or 'set'\\.","errorType":"exception","errorClass":"ReflectionException","httpStatus":null,"severity":"error","filePath":"src/main/java/org/apache/ibatis/reflection/property/PropertyNamer.java","lineNumber":37,"sourceCode":"\nimport org.apache.ibatis.reflection.ReflectionException;\n\n/**\n * @author Clinton Begin\n */\npublic final class PropertyNamer {\n\n  private PropertyNamer() {\n    // Prevent Instantiation of Static Class\n  }\n\n  public static String methodToProperty(String name) {\n    if (name.startsWith(\"is\")) {\n      name = name.substring(2);\n    } else if (name.startsWith(\"get\") || name.startsWith(\"set\")) {\n      name = name.substring(3);\n    } else {\n      throw new ReflectionException(\n          \"Error parsing property name '\" + name + \"'.  Didn't start with 'is', 'get' or 'set'.\");\n    }\n\n    if (name.length() == 1 || name.length() > 1 && !Character.isUpperCase(name.charAt(1))) {\n      name = name.substring(0, 1).toLowerCase(Locale.ENGLISH) + name.substring(1);\n    }\n\n    return name;\n  }\n\n  public static boolean isProperty(String name) {\n    return isGetter(name) || isSetter(name);\n  }\n\n  public static boolean isGetter(String name) {\n    return name.startsWith(\"get\") && name.length() > 3 || name.startsWith(\"is\") && name.length() > 2;\n  }\n","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/mybatis/mybatis-3/blob/008069adb1b089579b5dcba87ee591908b263274/src/main/java/org/apache/ibatis/reflection/property/PropertyNamer.java#L19-L55","documentation":"MyBatis's Reflector only treats accessor methods whose names start with 'is', 'get' or 'set' as bean property accessors. PropertyNamer.methodToProperty strips that prefix to derive the property name; when a method name has none of these prefixes there is no property name to derive, so a ReflectionException is thrown. In normal flow Reflector filters candidates through PropertyNamer.isProperty first, so hitting this usually means methodToProperty was called directly or a custom Reflector/ObjectWrapper fed it an unfiltered method.","triggerScenarios":"Calling PropertyNamer.methodToProperty(\"someMethod\") or any name not starting with is/get/set; a custom Reflector implementation that passes all methods (not just isProperty()-filtered ones) into methodToProperty; a custom ObjectWrapper or plugin that resolves property names from arbitrary method names.","commonSituations":"Extending MyBatis reflection (custom wrappers, frameworks built on Reflector); upgrading MyBatis versions where Reflector method filtering changed; unit tests invoking PropertyNamer directly.","solutions":["Ensure only names passing PropertyNamer.isProperty(name) (i.e. isGetter/isSetter per the class's own rules) reach methodToProperty","Rename the method in your bean to follow JavaBean conventions (getX/setX/isX) if it is meant to be a property accessor","If you call methodToProperty directly, guard with isProperty() first (note: isProperty excludes Object getClass and ObjectStream can equals methods)","Debug which method name is passed in and fix the caller that bypassed the filter"],"exampleFix":"// before\nString prop = PropertyNamer.methodToProperty(method.getName()); // throws for \"toString\"\n\n// after\nif (PropertyNamer.isProperty(method.getName())) {\n  String prop = PropertyNamer.methodToProperty(method.getName());\n}","handlingStrategy":"validation","validationCode":"String prop;\nif (org.apache.ibatis.reflection.property.PropertyNamer.isProperty(method.getName())) {\n  prop = org.apache.ibatis.reflection.property.PropertyNamer.methodToProperty(method.getName());\n} else {\n  // not an accessor; skip or handle\n}","typeGuard":null,"tryCatchPattern":"try {\n  String prop = PropertyNamer.methodToProperty(name);\n} catch (ReflectionException e) {\n  // log the offending method name and skip it; do not retry\n}","preventionTips":["Always filter method names through PropertyNamer.isProperty before deriving property names","Keep bean accessors named per JavaBean conventions (is/get/set prefixes)","In custom Reflectors, mirror Reflector's filtering instead of passing every Method"],"tags":["reflection","javabean","properties","mybatis"],"backgroundTag":null,"analyzedSha":"008069adb1b089579b5dcba87ee591908b263274","analyzedAt":"2026-08-14T13:07:10.264Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}