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.
[release31 Dec 4] If you have some DefaultDataObject template--say, foo.gif when the image module is not installed--and instantiate it, you will get as a result somename.gif.gif instead of simply somename.gif. It must then be manually renamed.
I am assing to Yarda on the assumption this was caused by DefaultDataObject.java 1.14 which he committed.
True, it does work correctly by itself. I should restate the bug: when the DDO is present in a .group group template, and is created from group template, then the extension is doubled. I will attach a ZIP demonstrating the problem: unpack into your system/ folder, then make a template from "together (group)" named e.g. "testme". You get testmebar.xml and testmefoo.blatt.blatt (wrong).
Created attachment 371 [details] test template, unpack to $NBUSER/system/
I think it's because DefaultDataObject.getName() returns name of the file WITH extension -- e.g. __sample__foo.blatt instead of __sample__foo (as DataObject does). Then this name is given to DataObject.createFromTemplate(...) which adds the extension again... From the "group's point of view" the only way how to fix this is to explicitly remove extension from name obtained from DefaultDataObject. But this is not very nice... So?
True, the group should not have to specially pay attention to this, it looks like DDO is at fault. Perhaps DDO.createFromTemplate() should specially check whether the passed-in name provides an extension, and if so use that in place of the current extension, else append the current extension as now. Sort of ugly, but does it make sense?
I think the user doesn't want to change extension - so if s/he enters e.g. 'my.foo' then expects 'my.foo.blatt' to be created. So maybe the extension of passed name should be compared to current extension ('foo.blatt' remains 'foo.blatt') -- that should be the only case when extension was returned by getName() during templating of group. There could still be some problems with dots in name of templated group (e.g. 'my.blatt' :), but it should be very rare... [BTW why DDO.getName() returns name with extension?]
That's probably a good compromise. DDO.getName() -> name + ext, in order that it be renamable with the extension (cf. recently closed bug).
Still broken in 3.2 release.
Fixed in main trunk. Diff: http://www.netbeans.org/unbranded- source/browse/openide/src/org/openide/loaders/DefaultDataObject.java.diff? r1=1.15&r2=1.16
Resolved for 3.4.x or earlier, no new info since then -> verified
Resolved for 3.4.x or earlier, no new info since then -> closing.