Bug 492951 - [build path] "Add to Build Path" should not allow to add *anything*
Summary: [build path] "Add to Build Path" should not allow to add *anything*
Status: CLOSED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.8.2   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords: bugday
Depends on:
Blocks:
 
Reported: 2016-05-04 03:36 EDT by Andrey Loskutov CLA
Modified: 2020-04-01 14:00 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrey Loskutov CLA 2016-05-04 03:36:04 EDT
AS IS:
Go to *any* file in a Java project (let say pom.xml), right click on it and say "Build Path -> Add to Build Path". 

1) The pom.xml appears int the "Referenced Libraries" node, 
2) a build path error is created: "Description	Resource	Path	Location	Type
Archive for required library: 'pom.xml' in project 'org.eclipse.ui' cannot be read or is not a valid ZIP file	org.eclipse.ui		Build path	Build Path Problem"
3) An error is logged: "org.eclipse.jdt.core Error Invalid ZIP archive: pom.xml [in org.eclipse.ui]"

TO BE:
There must be some restrictions added to the action (e.g. show the menu only on *.jar, *.war, *.ear, *.zip files) OR at least some trivial validation checks should be done in AddSelectedLibraryToBuildpathAction (e.g. check if the file can be opened by a zip stream or something like that).

This is of course stupid to do such things from the user side (but it happened in real life :-) ), but if one accidentally selects more or different files as planned, this will break the project compilation state and this is not nice.

Reproducible in Eclipse 3.8.2 / 4.6 M6
Comment 1 Eclipse Genie CLA 2020-04-01 14:00:48 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.