This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 108146 - Multiple calls to IndentTask.reindent() in multilanguage environment.
Summary: Multiple calls to IndentTask.reindent() in multilanguage environment.
Status: RESOLVED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Formatting & Indentation (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Miloslav Metelka
URL:
Keywords:
Depends on:
Blocks: 102058
  Show dependency tree
 
Reported: 2007-06-26 14:10 UTC by Marek Fukala
Modified: 2007-11-05 13:39 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marek Fukala 2007-06-26 14:10:32 UTC
I have implemented the editor/indent module IndentTaskFactory and registered it to text/x-jsp mimetype. When I press
enter in a JSP page the IndentTask.reindent() method is called multiple times. 

It is caused by the used mechanism of collecting tasks in TaskHandler.MimeItem.createTask(). It uses mimelookup to find
instancies of IndentTaskFactory for all possible mimepaths in the document. There are multiple mimepaths in JSP
document. For example: text/x-jsp, text/x-jsp/text/java, text/x-jsp/text/x-el etc. The current mimelookup algorithm
returns the implementation registered to text/x-jsp  for each ot these mimepaths. Since they are stored in a hashmap
with MimePath key the same instance of IndentTaskFactory is used multiple times.
Comment 1 Vitezslav Stejskal 2007-06-26 14:45:53 UTC
We may need to change the composition of MimeLookup. That will have to be made carefully as it affects pretty much
everything.
Comment 2 Marek Fukala 2007-06-26 14:50:38 UTC
Yes, but Milo, please workaround the problem in your implementation asap as we agreed. Thanks.
Comment 3 Miloslav Metelka 2007-06-26 15:36:54 UTC
I have added check for whether a multiple same factories registration.
Checking in TaskHandler.java;
/cvs/editor/indent/src/org/netbeans/modules/editor/indent/TaskHandler.java,v  <--  TaskHandler.java
new revision: 1.3; previous revision: 1.2

I have filed a separate issue 108173 for the mimepaths resolving order.