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.
There are several problems I can see with this class today. 1. The distinction between typed and untyped source roots is unnecessary and wrong. The correct behavior is to apply the most specific <source-folder>, i.e. that folder which is the nearest ancestor of the file. 2. Use of FileUtil.isParentOf ignores the fact that this method returns false in case the folder itself is passed as the second argument, which is in fact done by java/source. 3. Charset.forName should be called during computeEncodingsCache, and IllegalCharsetNameException should be reported. 4. There is no unit test, which is inexcusable for a query impl. 5. The file currently shows unchecked compiler warnings - please fix these. 6. Most significantly, the impl is completely broken for projects which use property substitutions in <location>. For example, try making the Freeform Anagram sample (Freeform Project Extras module). The query will not work because <location>${src.dir}</location> is not correctly interpreted. You need to use PropertyEvaluator.evaluate (and beware of a null return value). This also implies that you need to attach a listener to the PropertyEvaluator (AntProjectListener.propertiesChanged does _not_ suffice) and clear the cache in case you receive a prop change event, as it might have affected source folder locations. 7. Special-case code for location.equals(".") is unnecessary; just use helper.resolveFileObject and it will handle such paths. In fact the current code will not work at all for <location>../src</location>, for example.
By the way, I added logging to both FileEncodingQuery and ProjectFileEncodingQueryImplementation, which may prove useful in getting diagnostics from users.
I'm already working on this issue, I just forgot to set TM.
Better impl. of FreeformFileEncodingQueryImpl. Checking in ant/freeform/src/org/netbeans/modules/ant/freeform/FreeformFileEncodingQueryImpl.java; /cvs/ant/freeform/src/org/netbeans/modules/ant/freeform/FreeformFileEncodingQueryImpl.java,v <-- FreeformFileEncodingQueryImpl.java new revision: 1.5; previous revision: 1.4 done Checking in ant/freeform/src/org/netbeans/modules/ant/freeform/FreeformProject.java; /cvs/ant/freeform/src/org/netbeans/modules/ant/freeform/FreeformProject.java,v <-- FreeformProject.java new revision: 1.53; previous revision: 1.52 done Checking in java/freeform/test/unit/src/org/netbeans/modules/java/freeform/FileEncodingQueryTest.java; /cvs/java/freeform/test/unit/src/org/netbeans/modules/java/freeform/FileEncodingQueryTest.java,v <-- FileEncodingQueryTest.java new revision: 1.4; previous revision: 1.3 done Checking in java/freeform/src/org/netbeans/modules/java/freeform/ui/ProjectModel.java; /cvs/java/freeform/src/org/netbeans/modules/java/freeform/ui/ProjectModel.java,v <-- ProjectModel.java new revision: 1.18; previous revision: 1.17 done ad 4) There was a test but under java/freeform/test, I've updated that test.