UnsupportedFormatException strange

Hello guys,

I recently work on a rb to xojo project and i have a lot of headache with the UnsupportedFormatException and the fun part is that if i press on it it gives me ErrorNumber 0, message nothing, Reason nothing, so very helpful.

the code comes like this :

[code] if clinicSet <> nil then
while not(clinicSet.eof)
admnb = clinicSet.field(“nbadm”).integerValue

  cliPictFile = clinicSet.field("headername").TextValue
  
  if not(app.SFolderItem.child("cliniques").exists) then
    app.SFolderItem.child("cliniques").createAsFolder
  end if
  
 
  [b]if app.SFolderItem.child("cliniques").child(cliPictFile).Exists then[/b]   // here is where the exception stops the code and shows . 
   
    cliPict = Picture.Open(app.SFolderItem.child("cliniques").child(cliPictFile))[/code]

now if i check the cliPictFile = clinicSet.field(“headername”).TextValue it gives me nothing, so the record was empty, now , logically it is that app.SFolderItem.child(“cliniques”).child(cliPictFile).Exists will be not true because the cliPictFile is nil but now how i can step over this and make the code working ?

i think i`m repeating myself but it would be nice to show at least some info when i press in the debugger on that error , not just to throw it like that .

Thanks again in advance guys.

[quote=159428:@Aurelian Negrea]Hello guys,

I recently work on a rb to xojo project and i have a lot of headache with the UnsupportedFormatException and the fun part is that if i press on it it gives me ErrorNumber 0, message nothing, Reason nothing, so very helpful.

the code comes like this :

[code] if clinicSet <> nil then
while not(clinicSet.eof)
admnb = clinicSet.field(“nbadm”).integerValue

  cliPictFile = clinicSet.field("headername").TextValue
  
  if not(app.SFolderItem.child("cliniques").exists) then
    app.SFolderItem.child("cliniques").createAsFolder
  end if
  
 
  [b]if app.SFolderItem.child("cliniques").child(cliPictFile).Exists then[/b]   // here is where the exception stops the code and shows . 
   
    cliPict = Picture.Open(app.SFolderItem.child("cliniques").child(cliPictFile))[/code]

now if i check the cliPictFile = clinicSet.field(“headername”).TextValue it gives me nothing, so the record was empty, now , logically it is that app.SFolderItem.child(“cliniques”).child(cliPictFile).Exists will be not true because the cliPictFile is nil but now how i can step over this and make the code working ?

i think i`m repeating myself but it would be nice to show at least some info when i press in the debugger on that error , not just to throw it like that .
[/quote]

  • Which version of Xojo ?
  • Mac, PC ?
  • What is the exact file name of cliPictFile ?

It is said at http://documentation.xojo.com/index.php/Picture

[quote]Cross-Platform Formats
These formats are cross-platform: SaveAsPNG, SaveAsJPEG, SaveAsWindowsBMP, SaveAsGIF, SaveAsTIFF. On Windows, these formats require GDI+; if it GDI+ is not available, then QuickTime will be used. If neither QuickTime or GDI+ is available then only BMP is supported on Windows.
Unrecognized formats or formats not supported for the built target will result in an UnsupportedFormatException. The Message property of the exception will contain additional information about what went wrong.
[/quote]

You cannot have a file with no name so if cliPictFile is truly blank then the exception seems reasonable here.

If you want your code to continue, then you should probably check if cliPictFile = “” before running code that expects it to not be blank.

If cliPictFile <> "" Then // Do my processing Else // Error, missing file name End If

could you please use local variables for the result of child, the other result of child, so you can debug it and see something in debugger?

Paul has probably found the insect. I checked that an empty cliPictFile does raise that exception.