Purchase your Section 508 Compliance Support guide now!

Purchase your Section 508 Compliance Support guide now!

Cognos SDK -- java get detailed exceptions

Hello, here is a sample snippet that I was using in a test Cognos SDK application to show the Cognos SDK generated error message.




public String getDetailedException(Exception e)
{
AxisFault f = (AxisFault)e;
String message;
String a1 = f.dumpToString();
int start = a1.indexOf("");
int end = a1.indexOf("
");
if(start > 0 && end > 0)
{
message = a1.substring(start+40,end-1) + "\n";
int start2 = a1.indexOf("",end);
int end2 = a1.indexOf("
",end+24);
if (start2 > 0 && end2 > 0) // more than one msg.
message = message + a1.substring(start2+40,end2-1) + "\n";
return message;
}
else
return a1;
}