NEW DATE! Bugzilla will undergo maintenance 2024-03-28 18h00 CET. Bugzilla will be placed in read-only mode at that time.

Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 32219 - JavaModel operations fail with ArrayIndexOutOfBoundsException if array empty
Summary: JavaModel operations fail with ArrayIndexOutOfBoundsException if array empty
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 2.1 RC1   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords: api, readme
Depends on:
Blocks: 32138
  Show dependency tree
 
Reported: 2003-02-19 05:59 EST by Adam Kiezun CLA
Modified: 2003-02-26 17:23 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Kiezun CLA 2003-02-19 05:59:05 EST
20020318
here's JavaModel.delete's code (beginning):

if (elements != null && elements[0] != null && elements[0].getElementType() < 
IJavaElement.TYPE) 

this throws ArrayIndexOutOfBoundsException if array is empty

javadoc allows empty arrays

same problem for:
 - copy
 - move
 - rename
Comment 1 Adam Kiezun CLA 2003-02-19 06:00:22 EST
not really major - workaround it trivial
Comment 2 Olivier Thomann CLA 2003-02-19 09:49:58 EST
In fact there is two problems.
All underneath operations throws a JavaModelException is there is no element to
process. So this should be done as well for the JavaModel operations.
I will update the doc to add one more cases for an exception to be thrown
running such operations and I will fix the code to prevent the
ArrayIndexOutOfBoundsException.
Fixed and released in 2.1 stream.
Comment 3 David Audel CLA 2003-02-25 07:19:06 EST
Verified.
Comment 4 Jim des Rivieres CLA 2003-02-26 17:23:36 EST
Added API compatibility note to 2.1 release notes.