Hi everbody,
[progress] Executing /DXLSupportScripts/src/reports/SVSOperatingFigures.dxl
-R-F- DXL: <reports/collectVVOperatingFigures.inc:77> internal error, please submit a bug report
Backtrace:
<reports/collectVVOperatingFigures.inc:175>
<reports/collectVVOperatingFigures.inc:306>
<reports/collectVVOperatingFigures.inc:405>
<Line:200>
-R-E- DXL: <reports/collectVVOperatingFigures.inc:77> An unexpected error has occurred: Unspecified Failure
Backtrace:
<reports/collectVVOperatingFigures.inc:175>
<reports/collectVVOperatingFigures.inc:306>
<reports/collectVVOperatingFigures.inc:405>
<Line:200>
-I- DXL: execution halted
[progress] Done.
int array_size(
/*IN*/ Array a)
{
int size = 0;
while( !null(get(a, size, 0) ) )
{
size++;
}
return size;
}
void array_push_str(
/*IN,OUT*/ Array a,
/*IN*/ string str)
{
int array_index = array_size(a);
put(a, str, array_index, 0);
}
int str_split(
/*IN*/ const string& str,
/*IN*/ const string& separator,
/*OUT*/ Array& tokens)
{
if(null tokens)
{
return 0;
}
Buffer buf = create;
int str_index;
buf = "";
for(str_index = 0; str_index < length(str); str_index++)
{
if( str[str_index:str_index] == separator )
{
array_push_str(tokens, stringOf(buf));
buf = "";
}
else
{
buf += str[str_index:str_index];
}
}
array_push_str(tokens, stringOf(buf));
delete buf;
return array_size(tokens);
}
void parseAndAddProcedureNames(
/*IN*/ const string& str,
/*OUT*/ Array& setOfTestScripts)
{
//logTraceEnterFunc("parseAndAddProcedureNames(const string&,Array&)");
Array lines = create(1,1);
int count = str_split(str, NEWLINE, lines);
int i = 0;
for( i=0; i<count; ++i ) {
string procname = array_get_str(lines, i);
procname = str_trim(procname);
if( 0 < length(procname) && !array_contains_str(setOfTestScripts, procname) )
{
//logTrace("array_push_str(setOfTestScripts, '" procname "')");
array_push_str(setOfTestScripts, procname);
}
}
//logTraceLeaveFunc("parseAndAddProcedureNames(const string&,Array&)");
delete lines;
}
KaiK. - Fri Feb 24 08:55:40 EST 2012 |
Re: How to debug "An unexpected error has occurred: Unspecified Failure"
Ok the first thing to notice is that in DXL 'const parameter definitions' are completly ignored. They do not seem to disturb either, but I still would not use them (bad experience with doing such stuff. Try "return (void) instead of return" for example. Will work 1000x but fail you with an error the 1001th time.)
void func(const string x) { x = "allo"; print x }
func("Hello")
The next thing to notice is, that the bug that you are experiencing might not be in the code you posted. When you say that another module processed fine, but one gives you an error, that might mean, that some part of the code does not handle an object or module correctly. The code you have posted however seems to handle only normal string data - if it failed it would probably fail for all of your modules. There is one exception:
int array_size(Array a)
{
while( !null(get(a, size, 0) ) ) // This line is fishy!
...
}
// either make separator a 'char' or use a substring of valid length if( str[str_index:str_index] == separator ) // should be: if( str[str_index:str_index+lSeparator-1] == separator) // don't forget to increase the index accordingly!
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
|
Re: How to debug "An unexpected error has occurred: Unspecified Failure" Mathias Mamsch - Fri Feb 24 10:36:40 EST 2012
Ok the first thing to notice is that in DXL 'const parameter definitions' are completly ignored. They do not seem to disturb either, but I still would not use them (bad experience with doing such stuff. Try "return (void) instead of return" for example. Will work 1000x but fail you with an error the 1001th time.)
void func(const string x) { x = "allo"; print x }
func("Hello")
The next thing to notice is, that the bug that you are experiencing might not be in the code you posted. When you say that another module processed fine, but one gives you an error, that might mean, that some part of the code does not handle an object or module correctly. The code you have posted however seems to handle only normal string data - if it failed it would probably fail for all of your modules. There is one exception:
int array_size(Array a)
{
while( !null(get(a, size, 0) ) ) // This line is fishy!
...
}
// either make separator a 'char' or use a substring of valid length if( str[str_index:str_index] == separator ) // should be: if( str[str_index:str_index+lSeparator-1] == separator) // don't forget to increase the index accordingly!
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
> Which line is line 77 in collectVVOperatingFigures? the call of str_split in parseAndAdd... |
Re: How to debug "An unexpected error has occurred: Unspecified Failure" First of all, if you are getting an error here: collectVVOperatingFigures.inc:77, then surely you should be posting that code and telling us which is line 77. Posting the surrounding code (as you did) may help, but not nearly as much. "const" seems right now to do nothing, but if ever they implement it then it would make no sense to use it in a call parameter, since they are not constants they are variables. You MUST "caste" retrievals from Skip and from Arrays. ALL your Array "get" command must look like this:
As for "Arrays", I'm setting into these conventions:
Your Array seems to have only one column. Seems to me a Skip list would work better. array_push_str() should not push a null string. If 'Separator' is a single character (such as a comma), then your code would be eaiser to read if it was defined as type "char". If its a string, such as ", " then your code doesn't work. -Louie |
Re: How to debug "An unexpected error has occurred: Unspecified Failure" llandale - Fri Feb 24 11:38:01 EST 2012
As for "Arrays", I'm setting into these conventions:
Your Array seems to have only one column. Seems to me a Skip list would work better. array_push_str() should not push a null string. If 'Separator' is a single character (such as a comma), then your code would be eaiser to read if it was defined as type "char". If its a string, such as ", " then your code doesn't work. -Louie |
Re: How to debug "An unexpected error has occurred: Unspecified Failure" KaiK. - Wed Feb 29 02:33:38 EST 2012 In your case the call to split_str is totally harmless und should not be the root of a crash. There is only one way I know to find the root cause of such problems. First start looking for all other definitions of split_str, NEWLINE, etc. Then comment out the call and see if the error still happens. If so start commenting out code, until the error goes away if necessary engineer the code back to a "Hello World", until the error goes away. You should start by removing any include dependencies. Just comment out all calls to other libraries one by one, and replace the return values of these functions by dummies. As soon as the error goes away, look at what you commented out last. Comment it back in to test, if the error really comes back. Then you start dealing only with this part of the code. Comment everything out in the problematic function and start commenting in code until the error comes back. You can do this until you find the exact line that is problematic. That way I was able to find the root of a lot of strange bugs in DXL. Maybe that helps, regards, Mathias Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS |