[hibernate-issues] [Hibernate-JIRA] Created: (HHH-6789) StringIndexOutOfBoundsException at TemplatedViolatedConstraintNameExtracter.extractUsingTemplate

Dimitris Zenios (JIRA) noreply at atlassian.com
Tue Nov 1 07:20:23 EDT 2011


StringIndexOutOfBoundsException at TemplatedViolatedConstraintNameExtracter.extractUsingTemplate
------------------------------------------------------------------------------------------------

                 Key: HHH-6789
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6789
             Project: Hibernate Core
          Issue Type: Bug
          Components: core
    Affects Versions: 4.0.0.CR5
         Environment: PostgreSQL
            Reporter: Dimitris Zenios


TemplatedViolatedConstraintNameExtracter.extractUsingTemplate throws java.lang.StringIndexOutOfBoundsException: String index out of range: -1

Example values

templateStart = "violates check constraint \""
templateEnd = "\""
message = "new row for relation \"user_balance\" violates check constraint \"balance_check_constraint\""

This function broke from the last commit 
https://hibernate.onjira.com/browse/HHH-4854

In order to fix it, we have to change this on the function

int end = message.lastIndexOf( templateEnd, start );

to

int end = message.indexOf( templateEnd, start );


--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list