Community
Participate
Working Groups
Build Identifier: I20110526-1708 1. Create a mapping file in a source folder other than META-INF 2. Open make persistent wizard and select Add to XML mapping file radio button 3. Click Browse button and select the mapping file created in step 1 The value cannot be set to the text field with the exception below. Our code only accepts the mapping file from META-INF folder, but mapping files in the sources folders should be all valid to set, just like what the selecting mapping file dialog shows. java.lang.StringIndexOutOfBoundsException: String index out of range: -1 at java.lang.String.substring(Unknown Source) at java.lang.String.substring(Unknown Source) at org.eclipse.jpt.jpa.ui.internal.wizards.SelectJpaOrmMappingFileDialog.removeRedundantSegmentFromName(SelectJpaOrmMappingFileDialog.java:130) at org.eclipse.jpt.jpa.ui.internal.wizards.SelectJpaOrmMappingFileDialog.getChosenName(SelectJpaOrmMappingFileDialog.java:104) at org.eclipse.jpt.jpa.ui.internal.wizards.JpaMakePersistentWizardPage.mappingFileBrowseButtonPressed(JpaMakePersistentWizardPage.java:295) Full stack trace is attached. Reproducible: Always
Created attachment 200386 [details] Stack Trace
The root problem should be in the first line of the method below of SelectJpaOrmMappingFileDialog class. It assumes the input is only from META-INF folder. private String removeRedundantSegmentFromName(String input) { String output = input.substring(input.indexOf(META_INF)); output = output.replace(File.separatorChar, SLASH); return output; }
Created attachment 200476 [details] Proposed Patch
Nan, I have a few suggestions on your patch: 1. You added a tooltip to the new button in the SelectJpaOrmMappingFileDialog. This text needs to be externalized to JptUiMessages. 2. SelectJpaOrmMappingFileDialog.getChosenName(IProject) you don't need to pass in the IProject because it has already been passed in and stored in the constructor. Functionally this patch looks good to me
Created attachment 200765 [details] Proposed Patch Incorporated Karen's comments
Looks good! I have checked this in to HEAD. Neil, do you think we should put this in 3.0.1 maintenance as well?
(In reply to comment #6) > Neil, do you think we should put this in 3.0.1 maintenance as well? The severity is borderline, but if the fix is low-risk and solid, I say we push into maintenance.
Created attachment 200869 [details] proposed patch against 3.0 maintenance I've attached a patch against the maintenance stream that is the same minus the tooltip text that was added to a resource bundle.
checked in to 3_0_maintenance
Verified in Build I-3.4.0-20110805150738 Verified user can select mapping file from the folder other than META-INF in the Make Persistent Wizard without error. See the link to view test steps for verification. http://wiki.eclipse.org/Dali_3.0.1