While testing the compiled and encoded Rexx programs in the context of 
BSF4ooRexx, I found a problem
that is independent of BSF4ooRexx: sometimes, if creating the sourcecode from 
the string array
(makestring will not append a trailing LF) of the compiled and encoded Rexx 
program it may be the
case that StringUtils.decodeBase64() runs into an error, if the last encoded 
line ends in "==".

In this case the reason seems to be that the length of the data to be decoded 
(as determined in
ProgramMetaData.processRestoreData()) will cause decodeBase64() to assume an 
error, if no LF (or
CR-LF) is appended to the last two characters "=="; the test in decodeBase64() 
is:

                // if this is '=' and we're looking at
                // one of the last two digits, we've hit the
                // end
                if (ch == '=')
                {
                    // if we're looking for the first digit, then the next 
character
                    // muust also be an '='
                    if (digit == 2)
                    {
                        if (inputLength < 2 || *source != '=')
    ... cut ...

If there is no trailing [CR] LF in this case, then "inputLength < 2" yields 
true and the decoding fails.

One way of dealing with this is to append a LF in any case to the string that 
gets created for the
routine or method object from a string array as decodeBase64 is munching 
trailing [CR] LF.

Would a change like that be o.k.?

---rony

P.S.: I ran into this problem in a Win32 session, such that I can supply the 
compiled and encoded
Rexx programs. The one with a trailing LF works, the other without the trailing 
LF will cause: Error
3.905:  Encoded compiled program
"F:\work\svn\bsf4oorexx\trunk\bsf4oorexx\samples\JavaFX\fxml_01\str1.eencoded.rex"
 cannot be decoded.


_______________________________________________
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-devel

Reply via email to