Community
Participate
Working Groups
Build ID: M20080221-1800 Steps To Reproduce: 1. create a new Dynamic Web Project (with Dynamic Web Module 2.4 and Java 5.0) 2. create a new Java class like this: package a; public class TestClass { } 3. in WebContent, create a new JSP, name it test.jsp and accept al the defaults. This JSP is created: <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Insert title here</title> </head> <body> </body> </html> 4. at line 10, start a scriptlet and try to define a TestClass viariable, in this way: // cut // <body> <% TestCl <= invoke code completion here! %> </body> // cut // 5. invoke code completion as shown above: select TestClass as the completion proposal suggests 6. the result is the following: => an import is added after <!DOCTYPE>: <%@page import="a.TestClass"%> (this is ok!) => your class name is completed as "TestCls", instead of "TestClass"! 7. try to remove the last "s" of "TestCls" and invoke code completion again 8. select the suggested TestClass again; the result is the following: => another import is added, right after the first one, and also wrong: <%@page import="a.TestClass"%> <%@page import="TestClass"%> => the class name is still completed as "TestCls" instead of "TestClass"
What is interesting is that this is particular to the package name "a". The same problem doesn't manifest if the class is "b.TestClass" or "aa.TestClass".
Created attachment 146389 [details] Bug Fix Patch Problem was caused by several errors in the JSPProposalCollector class. The incorrect code completion was caused by an error when removing the signature from the class name. Thus, in the recreation scenario, the regular expression "a." was being removed from "a.TestClass" instead of "a\\.". This caused for all the 'a' characters followed by any character to be removed. The multiple page import of the same class was caused by a problem on the condition that determines when the auto adding of the page import is needed. Fixed code to address these problems.
Patch looks good. Thanks, Aidyl.