Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 355300 - [patch] Adding a managed dependency adds a blank dependency instead
Summary: [patch] Adding a managed dependency adds a blank dependency instead
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: m2e (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:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-20 16:33 EDT by benson margulies CLA
Modified: 2021-04-19 13:25 EDT (History)
6 users (show)

See Also:


Attachments
Proposed patch (5.60 KB, patch)
2013-03-21 17:14 EDT, Marcos Munoz CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description benson margulies CLA 2011-08-20 16:33:23 EDT
Build Identifier: 20110615-0604

If I search for an artifact in the dependency add dialog, and then click on the 'managed' line above all the individual version lines, the POM ends up with a blank artifactId and groupId instead of the actual values.

Note that this always happens for one of my local projects, and never for log4j.

At very least, I claim that the 'ok' button should be *disabled* until there are some values other than blank in groupId and artifactId. Even if you can't repro the failure to fill them in, you could repro and adjust that.


Reproducible: Sometimes

Steps to Reproduce:
1. click on add in the dependency view
2. type in an artifactId in the search box
3. tab
4. observe that the groupId and artifactId boxes have not been filled in.
5. click OK
6. observe that it goes ahead and adds a malformed XML element to the POM.
Comment 1 Neale Upstone CLA 2011-10-18 10:18:59 EDT
Reproducible always when artifact is managed.

Expected behaviour:

- Ok button should be disabled if dependency version is not managed
- If I click on the top entry when managed, then it should insert the groupId and artifactId, and enable the ok button
Comment 2 Marcos Munoz CLA 2013-03-21 17:14:20 EDT
Created attachment 228890 [details]
Proposed patch

The issue reported here does not only affects addition of entries to the Dependency and Dependency Management lists since in both cases the Add button launches the MavenRepositorySearchDialog. 

The patch do the next:
- Adds a method to validate the Group Id and Artifact Id fields
- Add two new error messages to report that the corresponding field has no value:
  + "Artifact Id cannot be empty"
  + "Group Id cannot be empty"
- Disables OK button until user enters a value in the fields or the fields are filled automatically when user selects an artifact from the list.
Comment 3 Roberto Sanchez Herrera CLA 2013-04-17 15:43:20 EDT
Hi, Any chance to have a review of this defect?
Comment 4 Igor Fedorenko CLA 2013-05-04 13:12:24 EDT
Reviewed and applied the patch. Thank you.
Comment 5 Denis Roy CLA 2021-04-19 13:25:23 EDT
Moved to https://github.com/eclipse-m2e/m2e-core/issues/