Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 263637 - string index out of bounds in TableDefinition.buildForeignKeyConstraintName
Summary: string index out of bounds in TableDefinition.buildForeignKeyConstraintName
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard: submitted_patch
Keywords:
: 283508 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-02-04 09:09 EST by Gregor Zeitlinger CLA
Modified: 2022-06-09 10:08 EDT (History)
3 users (show)

See Also:
peter.krogh: iplog+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gregor Zeitlinger CLA 2009-02-04 09:09:42 EST
Steps To Reproduce:
1. have a FK involving a very long field name


More information:
I've fixed a but in TableDefinition that is apparently filed in glassfish, but not fixed there (see https://glassfish.dev.java.net/issues/show_bug.cgi?id=3554)

The bug still exists in the 2.0 nightly snapshot.
                   if (foreignKeyName.length() > maximumNameLength) {
                       // Still too long: remove vowels from the table name and field name and truncate the table name.
                       String shortenedFieldName = Helper.removeVowels(onlyAlphaNumericFieldName);
                       String shortenedTableName = Helper.removeVowels(onlyAlphaNumericTableName);
                       foreignKeyName = Helper.truncate(shortenedTableName, maximumNameLength - shortenedFieldName.length()) + shortenedFieldName;
                   }
becomes  

if (foreignKeyName.length() > maximumNameLength) {
                       // Still too long: remove vowels from the table name and field name and truncate the table name.
                       String shortenedFieldName = Helper.removeVowels(onlyAlphaNumericFieldName);
                       String shortenedTableName = Helper.removeVowels(onlyAlphaNumericTableName);
                                               if (shortenedFieldName.length() >= maximumNameLength) {
                        foreignKeyName = Helper.truncate(shortenedFieldName, maximumNameLength);
                       } else {
                           foreignKeyName = Helper.truncate(shortenedTableName, maximumNameLength - shortenedFieldName.length()) + shortenedFieldName;
                       }
                   }
Comment 1 Tom Ware CLA 2009-02-04 12:57:48 EST
Setting target to 1.1X so this bug will be a candidate for the first patch release after 1.1
Comment 2 Peter Krogh CLA 2009-06-22 16:00:31 EDT
Suggested fix checked in.
Comment 3 Peter Krogh CLA 2009-08-26 09:46:53 EDT
Mass update to change fixed in target.
Comment 4 Peter Krogh CLA 2009-08-26 09:49:11 EDT
Mass update to change fixed in target.
Comment 5 Peter Krogh CLA 2009-08-26 09:54:24 EDT
Mass update to change fixed in target.
Comment 6 Peter Krogh CLA 2009-08-26 09:56:43 EDT
Mass update to change fixed in target.
Comment 7 Tom Ware CLA 2010-02-08 14:02:45 EST
*** Bug 283508 has been marked as a duplicate of this bug. ***
Comment 8 Eclipse Webmaster CLA 2022-06-09 10:08:34 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink