Project JEDI - Issue Tracker
Mantis Bugtracker

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0003680 [JEDI VCL] 00 JVCL Components block always 2006-05-02 12:28 2006-06-05 08:25
Reporter Salvatore Besso View Status public  
Assigned To obones
Priority normal Resolution fixed  
Status resolved   Product Version Daily / GIT
Summary 0003680: TJvAppIniFileStorage always add ".ini" extension
Description This 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
Additional Information
Tags No tags attached.
Attached Files zip file icon TestCase.zip [^] (10,482 bytes) 2006-05-03 04:35

- Relationships

-  Notes
(0009239)
obones (administrator)
2006-05-02 12:49

This was a bug in the JCL and to me, it is fixed. If not, please provide a sample application showing the problem.
(0009245)
Salvatore Besso (reporter)
2006-05-03 04:34

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.
(0009254)
Salvatore Besso (reporter)
2006-05-05 04:38

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
(0009333)
obones (administrator)
2006-05-21 09:32

This is now fixed in SVN
(0009346)
Salvatore Besso (reporter)
2006-05-24 04:24
edited on: 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

(0009386)
obones (administrator)
2006-06-05 08:25

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 04:35 Salvatore Besso Issue Monitored: Salvatore Besso
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
2010-05-24 14:39 Salvatore Besso Issue End Monitor: Salvatore Besso


Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker