View Issue Details

IDProjectCategoryView StatusLast Update
0003680JEDI VCL00 JVCL Componentspublic2006-06-05 08:25
ReporterSalvatore BessoAssigned Toobones 
PrioritynormalSeverityblockReproducibilityalways
Status resolvedResolutionfixed 
Product VersionDaily / GIT 
Target VersionFixed in Version3.30 
Summary0003680: TJvAppIniFileStorage always add ".ini" extension
DescriptionThis is related to JVCL 3.30 daily snapshot of April 25. I use TJvAppIniFileStorage component in several forms of a project. I usually assign TJvAppIniFileStorage.Filename property manually in code, for example:

IniStore.Filename := 'Stampe.IT';

In this example the extension is the ISO code of a language file.

Now with JVCL 3.30 the component arbitrarily changes the Filename extension after the assignment, appending .ini, so the file name now becomes:

Stampe.IT.ini

and of course my whole project is now broken. It is not unusual to have files with different extensions and until JVCL version 3.10 (I have never used 3.20) it worked fine and the extension was not changed. IMHO the old behaviour should be restored ASAP.

P.S.: I have not included any test case because it is so simple. Drop a TJvAppIniFileStorage component on a form and assign its Filename property in code. Run and examine Filename value after the assignment.

Thank you
TagsNo tags attached.

Activities

obones

2006-05-02 12:49

administrator   ~0009239

This was a bug in the JCL and to me, it is fixed. If not, please provide a sample application showing the problem.

Salvatore Besso

2006-05-03 04:34

reporter   ~0009245

The problem is confirmed with latest snapshot of both JCL (rev. 1633) and JVCL (rev. 10580) downloaded one hour ago. Now I have also attached a test case that demonstrates the problem. Sorry if I insist here, but I rarely use the JCL alone and so I don't know where the bug could be in the JCL.

2006-05-03 04:35

 

TestCase.zip (10,482 bytes)

Salvatore Besso

2006-05-05 04:38

reporter   ~0009254

I don't think it's a JCL issue. This is what I have found in file JvAppStorage.pas referred to the TJvCustomAppMemoryFileStorage class from which TJvAppIniFileStorage descends. Please see the setter procedure TJvCustomAppMemoryFileStorage.SetFileName:

begin
  if FFileName <> PathAddExtension(Value, DefaultExtension) then
  begin
    if not (csLoading in ComponentState) and not IsUpdating then
      Flush;
    FFileName := PathAddExtension(Value, DefaultExtension);
    FPhysicalReadOnly := FileExists(FullFileName) and FileIsReadOnly(FullFileName);
    if not (csLoading in ComponentState) and not IsUpdating then
      Reload;
  end;
end;

As you can see, the DefaultExtension is ALWAYS added to the FileName property.

Regards

obones

2006-05-21 09:32

administrator   ~0009333

This is now fixed in SVN

Salvatore Besso

2006-05-24 04:24

reporter   ~0009346

Last edited: 2006-05-24 04:30

hello Obones,

I'm sorry, but this issue is not fixed, instead it is worse than before :-) because now the Filename property is never assigned if you try to assign a filename containing an extension different than .ini. You can use the same test case used before:

procedure TJvCustomAppMemoryFileStorage.SetFileName(const Value: TFileName);
begin
  // Mantis 3680: only add an extension if there is not already one.
  if (Length(ExtractFileExt(Value)) = 0) then
  begin
    if not (csLoading in ComponentState) and not IsUpdating then
      Flush;
    FFileName := PathAddExtension(Value, DefaultExtension);
    FPhysicalReadOnly := FileExists(FullFileName) and FileIsReadOnly(FullFileName);
    if not (csLoading in ComponentState) and not IsUpdating then
      Reload;
  end;
end;

It is evident that if I try to assing for example "Test.IT" to the property, the above code is never executed and the property remains unassigned.

This is only a suggestion on how to rewrite this method:
-----------------------------------------------------------------
procedure TJvCustomAppMemoryFileStorage.SetFileName(const Value: TFileName);
  // Mantis 3680: only add an extension if there is not already one.
  if not (csLoading in ComponentState) and not IsUpdating then
    Flush;
  if (Length(ExtractFileExt(Value)) = 0) then
    FFileName := PathAddExtension(Value, DefaultExtension)
  else FFileName := Value;
  FPhysicalReadOnly := FileExists(FullFileName) and FileIsReadOnly(FullFileName);
  if not (csLoading in ComponentState) and not IsUpdating then
    Reload;
end;
-----------------------------------------------------------------

Regards
Salvatore

obones

2006-06-05 08:25

administrator   ~0009386

This has been fixed by revision 10616, please update your local copy.

Issue History

Date Modified Username Field Change
2006-05-02 12:28 Salvatore Besso New Issue
2006-05-02 12:49 obones Status new => resolved
2006-05-02 12:49 obones Resolution open => fixed
2006-05-02 12:49 obones Assigned To => obones
2006-05-02 12:49 obones Note Added: 0009239
2006-05-03 04:34 Salvatore Besso Status resolved => feedback
2006-05-03 04:34 Salvatore Besso Resolution fixed => reopened
2006-05-03 04:34 Salvatore Besso Note Added: 0009245
2006-05-03 04:35 Salvatore Besso File Added: TestCase.zip
2006-05-03 14:05 obones Summary TJvAppIniFileStorage arbitrarily changes Filename extension => TJvAppIniFileStorage always add ".ini" extension
2006-05-05 04:38 Salvatore Besso Note Added: 0009254
2006-05-21 09:32 obones Status feedback => resolved
2006-05-21 09:32 obones Resolution reopened => fixed
2006-05-21 09:32 obones Note Added: 0009333
2006-05-24 04:24 Salvatore Besso Status resolved => feedback
2006-05-24 04:24 Salvatore Besso Resolution fixed => reopened
2006-05-24 04:24 Salvatore Besso Note Added: 0009346
2006-05-24 04:29 Salvatore Besso Note Edited: 0009346
2006-05-24 04:30 Salvatore Besso Note Edited: 0009346
2006-06-05 08:25 obones Status feedback => resolved
2006-06-05 08:25 obones Resolution reopened => fixed
2006-06-05 08:25 obones Note Added: 0009386