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 8750 - Creating a DefaultDataObject from template in .group doubles extension
Summary: Creating a DefaultDataObject from template in .group doubles extension
Status: CLOSED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 3.x
Hardware: PC Linux
: P4 minor (vote)
Assignee: akemr
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2000-12-04 11:33 UTC by Jesse Glick
Modified: 2008-12-22 19:12 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
test template, unpack to $NBUSER/system/ (1.51 KB, application/octet-stream)
2000-12-05 14:14 UTC, Jesse Glick
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2000-12-04 11:33:17 UTC
[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.
Comment 1 Jesse Glick 2000-12-04 11:55:59 UTC
I am assing to Yarda on the assumption this was caused by DefaultDataObject.java
1.14 which he committed.
Comment 2 Jesse Glick 2000-12-05 14:11:59 UTC
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).
Comment 3 Jesse Glick 2000-12-05 14:14:59 UTC
Created attachment 371 [details]
test template, unpack to $NBUSER/system/
Comment 4 Tomas Pavek 2000-12-05 15:18:59 UTC
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?
Comment 5 Jesse Glick 2000-12-05 15:27:59 UTC
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?
Comment 6 Tomas Pavek 2000-12-05 16:05:59 UTC
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?]
Comment 7 Jesse Glick 2000-12-05 18:11:59 UTC
That's probably a good compromise.

DDO.getName() -> name + ext, in order that it be renamable with the extension
(cf. recently closed bug).
Comment 8 Jesse Glick 2001-05-09 18:45:37 UTC
Still broken in 3.2 release.
Comment 9 akemr 2001-05-15 08:57:33 UTC
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
Comment 10 Quality Engineering 2003-07-01 15:51:32 UTC
Resolved for 3.4.x or earlier, no new info since then -> verified
Comment 11 Quality Engineering 2003-07-01 16:11:02 UTC
Resolved for 3.4.x or earlier, no new info since then -> closing.