Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The propertyName in PropertyPath constructor doesn't follow the Javabeans Specification. [DATACMNS-1009] #1459

Open
spring-projects-issues opened this issue Mar 15, 2017 · 2 comments
Assignees
Labels
in: mapping type: bug

Comments

@spring-projects-issues
Copy link

@spring-projects-issues spring-projects-issues commented Mar 15, 2017

lin opened DATACMNS-1009 and commented

The propertyName changing as below in the PropertyPath constructor doesn't follow the JavaBeans Specification (8.8 Capitalization of inferred names.).

// PropertyPath Code: lines 73:
PropertyPath(String name, TypeInformation<?> owningType, List<PropertyPath> base) {
...
    String propertyName = name.matches(ALL_UPPERCASE) ? name : StringUtils.uncapitalize(name);
...
}

The code means the first capital letter is changed to lowercase when the name doesn't matche ALL_UPPERCASE.
But the JavaBeans Specification says:

Thus when we extract a property or event name from the middle of an existing Java name, we
normally convert the first character to lower case. However to support the occasional use of all
upper-case names, we check if the first two characters of the name are both upper case and if
so leave it alone. So for example,
    “FooBah” becomes “fooBah”
    “Z” becomes “z”
    “URL” becomes “URL”

For example:
When I have a property named [MCount] in a class, I use PropertyPath.from to get the property, I'll get the following exception, because the property name was changed to [mCount].

PropertyPath property = PropertyPath.from("MCount", classType);

Exception:
java.lang.IllegalArgumentException: Unable to locate Attribute with the the given name [mCount] on this ManagedType [class]...


Affects: 1.13.1 (Ingalls SR1)

Reference URL: http://stackoverflow.com/questions/43674116/why-the-propertyname-in-propertypath-constructor-doesnt-follow-the-javabeans-sp

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented May 8, 2017

lin commented

Hi, I've asked this issue on StackOverflow, I think it's a bug, would someone please confirm this again?

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Jul 5, 2017

lin commented

somebody?

@spring-projects-issues spring-projects-issues added type: bug in: mapping labels Dec 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: mapping type: bug
Projects
None yet
Development

No branches or pull requests

2 participants