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

Part.extractProperty(String part) invalidly extracts property paths containing keywords [DATACMNS-750] #1211

Closed
spring-projects-issues opened this issue Aug 12, 2015 · 1 comment
Assignees
Labels
in: core type: bug

Comments

@spring-projects-issues
Copy link

@spring-projects-issues spring-projects-issues commented Aug 12, 2015

rexli opened DATACMNS-750 and commented

I declare a method named findByLeakInfoAuditStateIn(Collection states). When I start up my application, Spring Data throws an exception:

PropertyReferenceException: No property leak found for type Leak!

LeakInfo is a bean, Leak is not. Then i debug into source, i found source that:

public String extractProperty(String part) {

  String candidate = StringUtils.uncapitalize(part);
  for (String keyword : keywords) {
    if (candidate.endsWith(keyword)) {
      return candidate.substring(0, candidate.indexOf(keyword));
    }
  }
  return candidate;
}

The String.indexOf(…) method find the first In within LeakInfo. That's not excepted. May be use String.lastIndexOf(…) instead?


Affects: 1.10.2 (Fowler SR2), 1.11 RC1 (Gosling)

Referenced from: pull request #136, and commits cc1aa71, bbfd626

Backported to: 1.10.3 (Fowler SR3)

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Aug 13, 2015

Oliver Drotbohm commented

Good catch, I decided to switch to a slightly different implementation and added a test case. Fixed in master and the maintenance branch for Fowler

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core type: bug
Projects
None yet
Development

No branches or pull requests

2 participants