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.
Build: NetBeans IDE Dev (Build 090131) VM: Java HotSpot(TM) Client VM, 1.5.0_15-b04, Java(TM) 2 Runtime Environment, Standard Edition, 1.5.0_15-b04 OS: Linux, 2.6.27-11-generic, i386 User Comments: jglick: Find in Files, matching a *.properties file. Stacktrace: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java:0) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.netbeans.modules.search.Manager$1.run(Manager.java:440) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
Created attachment 76411 [details] stacktrace
Probable regression from recent changes to properties module. Prevented me from opening a project.properties file at all. Maybe it is getting confused by project.xml?
Easily reproducible. Just create a project, Go to File, "project.properties", Enter.
BTW files = new FileObject[listFileObjects.size()]; int index = 0; for (FileObject file : listFileObjects) { files[index++] = file; } can be simplified to files = listFileObjects.toArray(new FileObject[listFileObjects.size()]);
Clearly the following code is wrong: for (FileObject file : parent.getChildren()) { fName = file.getName(); if (fName.equals(baseName) && file.isValid()) { listFileObjects.add(0,file); } Should have: if (!file.hasExt("properties")) { continue; Even given that, getNthEntry should be written more conservatively and just quietly return null in case DataObject.find returns some other kind of DataObject; I have in fact heard on the mailing lists of people writing specialized data subtypes that match certain kinds of *.properties files. }
Thanks for comments. changeset 8f8221d23063
Commenting out the DataObjectNotFoundException.printStackTrace() where you did would not prevent the ClassCastException from being reported as an uncaught exception.
Yes, it is not prevent. But as you wrote the problem is that project.xml was taken into account. And it is fixed. So only PropertiesDataObject instances can get there now.
Added DataObject instanceof PropertiesDataObject check changeset 9f4151676c90
As I wrote earlier, it is possible (when using 3rd-party modules) for a *.properties file to not be a PropertiesDataObject. 9f4151676c90 looks right.