Go Back
3 Votes

OpenELB Should Throw An Exception When Passed Invalid Arguments


Closed

https://synergex.com/docs/index.htm#lrm/lrmChap9OPENELB.htm

As written today OpenELB will attempt to load in the following scenarios:

main

proc
	openelb('');
endmain
and
main

proc
	openelb('            ');
endmain

In both cases openelb should throw an ArgumentInvalidException or something similar; instead it attempts to open '.elb' like so:
 
%DBR-E-FNF, File not found
%DBR-I-FILWAS, File specification was .elb
%DBR-I-ATLINE, At line 4 in routine PROGRAM1 (Program1.dbl)


 

6 Comments | Posted by Ace Olszowka to Synergy DBL on 11/12/2019 4:41 PM
Mark Vinten
I would agree with the throwing of the error, though I think the error returned should be error 17
 
%DBR-E-FILSPC, Bad filename
%DBR-I-FILWAS, File specification was .elb
%DBR-I-ATLINE, At line 4 in routine PROGRAM1 (Program1.dbl)

As an empty name is a bad filespec.

11/22/2019 8:36 AM   1  
Jerry Fawcett
We agree this is a good idea, however a change to this area of the runtime could break existing customer applications, so we feel it’s best to leave the current behavior.

12/12/2019 7:37 PM   0  
Ace Olszowka

Is the argument that existing customer applications intentionally try to open files that do not exist and then capture the file not found exception?

Edit: Specifically that they attempt to open a file name that is nothing but spaces or zero characters?


12/12/2019 7:41 PM   0  
Mark Vinten
I think they are saying that people will have error handling for the non-existance of an ELB and trap this using the error that you originally posted.  If they were to correct the error to what I suggested or to provide a throw exception, this would negate that implemented logic resulting in programs crashing unexpected after an upgrade.

12/13/2019 12:59 PM   0  
Phillip Bratt
Appreciate the comments. Closing this Idea out as we are leaving the current behavior.

2/19/2020 3:10 PM   0  
Ace Olszowka
Thanks Phillip, for anyone following along at home, realize that this is a CWE-426 Primitive (http://cwe.mitre.org/data/definitions/426.html) program defensively around these locations to avoid this situation.

2/19/2020 4:19 PM   0  
Please log in to comment on this idea.