Uploaded image for project: 'Spring Data Commons'
  1. Spring Data Commons
  2. DATACMNS-750

Part.extractProperty(String part) invalidly extracts property paths containing keywords

    XMLWordPrintable

    Details

      Description

      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?

        Attachments

          Activity

            People

            Assignee:
            olivergierke Oliver Drotbohm
            Reporter:
            xzleah rexli
            Last updater:
            Oliver Drotbohm
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: