In a bug report which relates to BSF4ooRexx Jean-Louis was kind enough
to look into the issue and came up with an analysis in
<https://sourceforge.net/tracker/?func=detail&atid=684730&aid=3205263&group_id=119701>.

According to his findings, the RexxCondition member "program" was NULL
in the supplied example. Before changing/adapting the code, I was
wondering whether it is truly possible for the "program" member to be
NULL in the case of a SYNTAX condition?

What about the members "errortext", "code", "message", could they be
NULL as well in SYNTAX condition?

Is it safe to assume that the member "conditionName" will always have a
string value?

---rony

P.S.: Here is the code that uses DecodeConditionInfo(...) to create a
Rexx-like error message which then gets forwarded to the Java side,
where the line causing the crash is highlighted in bold red.

        // allocates and creates a Rexx-like error message
    inline char * RgfCreateRexxlikeErrorInfo (RexxThreadContext *rtc, 
RexxDirectoryObject condObj, const char * header)
    {
        rtc->ClearCondition();

        RexxCondition cond;
        rtc->DecodeConditionInfo(condObj, &cond);

        char *msg=(char *)RexxAllocateMemory( 4096 );
        msg[0]=0;

            // format message according to exception type
        if (rtc->SendMessage1(cond.conditionName, "EQUALS", 
rtc->String("SYNTAX"))==rtc->True()) // SYNTAX condition ?
        {
                                        // will only use 1024 of it
            char const 
*line1=rtc->CString(rtc->SendMessage0(rtc->DirectoryAt(condObj, "TRACEBACK"), 
"FIRSTITEM")) ; // first traceback line=error line
           
            char line2[2048]="";        // will only use 1024 of it
            SNPRINTF(line2, 2048, "Error %d running %.512s line %d:  %.1024s",
                              *  (int) cond.rc,       
rtc->CString(cond.program),*
                                (int) cond.position, 
rtc->CString(cond.errortext) );

            char line3[2048]="";        // will only use 1024 of it
            SNPRINTF( line3, 2048, "Error %d.%d:  %.1024s", (int) (cond.code / 
1000),
                                                    (int) (cond.code % 1000),
                                                     
rtc->CString(cond.message));

            SNPRINTF( msg, 4096, "%.16s%.512s:\n%.1024s\n%.1024s\n%.1024s", 
DLLNAME, header, line1, line2, line3);

        }
        else
        {
            SNPRINTF( msg, 4096, "%.16s%.512s: Rexx condition [%.512s] raised", 
DLLNAME, header, rtc->CString(cond.conditionName));
        }

        return msg;
    }

      


------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
Oorexx-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/oorexx-devel

Reply via email to