update readme and add gitignore
[client-tools.git] / tools / formatFilteredExceptionReport.pl
blob190812355512ecab2a9f20dc1260c4c8e117f1de
1 my @exceptions;
2 my $currentException = 0;
3 my $nearestWarning = "";
4 while(<STDIN>)
6 if($_ =~ /^* : WARNING |^WARNING: /)
8 $nearestWarning = $_;
10 if ($_ =~ /^java/)
12 $currentException++;
13 $exceptions[$currentException] = $nearestWarning.$_;
15 elsif($_ =~ /\s+at /)
17 $exceptions[$currentException] .= $_;
21 my @reportOutput;
22 my $reportIndex = 0;
23 my %dupeReport;
24 for ($i = 0; $i < @exceptions; $i++)
26 $duped = 0;
27 for($j = 0; $j < @reportOutput; $j++)
29 if($exceptions[$i] eq $reportOutput[$j])
31 $duped = 1;
32 break;
36 $reports = 1;
37 for($j = 0; $j < @exceptions; $j++)
39 if($i != $j)
41 if($exceptions[$i] eq $exceptions[$j])
43 $reports++;
48 if($duped == 0)
50 $callStack = $exceptions[$i];
51 $reportOutput[$reportIndex] = $exceptions[$i];
52 $reportIndex++;
53 $dupeReport{$callStack} = $reports;
58 print "Java Exception Report: $reportIndex unique call stacks logged. Total call stacks: $currentException\n";
59 print "Detailed report follows.\n\n\n\n";
61 foreach my $key (sort{$dupeReport{$b} <=> $dupeReport{$a}} keys %dupeReport)
63 print "\n=============================================\n\n";
64 print "$dupeReport{$key} reports:\n";
65 print $key;