Issue Details (XML | Word | Printable)

Key: GLASSFISH-3554
Type: Bug Bug
Status: Open Open
Priority: Minor Minor
Assignee: tware
Reporter: shelleyb
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
glassfish

Constraint Name Too Long Exception

Created: 29/Aug/07 01:32 PM   Updated: 06/Mar/12 10:06 PM
Component/s: entity-persistence
Affects Version/s: 9.0pe
Fix Version/s: not determined

Time Tracking:
Not Specified

Environment:

Operating System: All
Platform: All


Issuezilla Id: 3,554
Status Whiteboard:

HIGH

Tags:
Participants: gfbugbridge, pkrogh, shelleyb, Tom Mueller and tware


 Description  « Hide

During automatic DDL creation, if a generated foreign key constraint name is too
long, an exception occurs preventing schema creation. The
TableDefinition#buildForeignKeyConstraintName includes several levels of
conditionals to check whether the foreignKeyName is too long, but it is still
possible to be too long before calling to the Helper#truncate method.

The second parameter to Helper#truncate as created below can result in a
negative number, causing a StringIndexOutOfBoundsException to occur at the end
of the method (see stack trace below).

Helper.truncate(shortenedTableName, maximumNameLength -
shortenedFieldName.length()) + shortenedFieldName

java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(String.java:1768)
at oracle.toplink.essentials.internal.helper.Helper.truncate(Helper.java:1891)
at
oracle.toplink.essentials.tools.schemaframework.TableDefinition.buildForeignKeyConstraintName(TableDefinition.java:460)
at
oracle.toplink.essentials.tools.schemaframework.TableDefinition.buildForeignKeyConstraint(TableDefinition.java:429)
at
oracle.toplink.essentials.tools.schemaframework.DefaultTableGenerator.addForeignKeyConstraint(DefaultTableGenerator.java:735)
at
oracle.toplink.essentials.tools.schemaframework.DefaultTableGenerator.buildRelationTableFields(DefaultTableGenerator.java:362)
at
oracle.toplink.essentials.tools.schemaframework.DefaultTableGenerator.buildRelationTableDefinition(DefaultTableGenerator.java:328)
at
oracle.toplink.essentials.tools.schemaframework.DefaultTableGenerator.postInitTableSchema(DefaultTableGenerator.java:301)
at
oracle.toplink.essentials.tools.schemaframework.DefaultTableGenerator.generateDefaultTableCreator(DefaultTableGenerator.java:162)
at
oracle.toplink.essentials.tools.schemaframework.SchemaManager.getDefaultTableCreator(SchemaManager.java:802)
at
oracle.toplink.essentials.tools.schemaframework.SchemaManager.replaceDefaultTables(SchemaManager.java:853)
at
oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.createOrReplaceDefaultTables(EntityManagerFactoryProvider.java:426)
at
oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.runInSEMode(EntityManagerFactoryProvider.java:349)
at
oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.generateDDLFiles(EntityManagerFactoryProvider.java:329)
at
oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:230)
at
oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.getServerSession(EntityManagerFactoryImpl.java:93)
at
oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:126)
at
oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:120)
at
oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:91)
at
com.cerner.system.instrument.guernica.persistence.service.GuernicaErrorRecordServiceTest.setUp(GuernicaErrorRecordServiceTest.java:34)
at junit.framework.TestCase.runBare(TestCase.java:128)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:120)
at junit.framework.TestSuite.runTest(TestSuite.java:230)
at junit.framework.TestSuite.run(TestSuite.java:225)
at
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

This occurs with toplink-essentials-1.0-58c (implementation-version
2.0-b58c-fcs, 08/22/2007).



gfbugbridge added a comment - 29/Aug/07 05:01 PM

<BT6599016>


pkrogh added a comment - 30/Aug/07 05:41 AM

Downgrading because will not be fixed for this release. Would like to get this
for the next release


Tom Mueller added a comment - 06/Mar/12 10:06 PM

Bulk change to set fix version to "not determined" where the issue is open but the value is for a released version.