Code smells are defined as symptoms in the program source code which are usually not bugs or technically incorrect but indicates a possible deeper problem. Anti-patterns are counterparts of design patterns and are defined as mistakes during software development that produces negative consequences and is ineffective or counter-productive. During program execution, error events can occur that disrupts the normal flow of the program. Programming languages provide exception handling mechanism to developers for handling errors and exception events.
I mined the source-code (JFreeChart 1.0.17) for automatically detecting 10 exception handling anti-patterns
(https://today.java.net/article/2006/04/ ... tipatterns). In this issue report, I list the exception handling anti-patterns and code-smells that I found in the source code. My experimental results demonstrate presence of various exception handling anti-patterns and throw light on their intensity. I believe my tool for automatic detection of anti-patterns in source code and the attached results can be useful to programmers by helping them correct mistakes and write effective code.
Mining Source Code for Automatically Discovering Exception Management Anti-Patterns and Code Smell
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\source\org\jfree\chart\axis\PeriodAxis.java
CATCH CLAUSE : catch (Exception e) {
try {
Constructor c=periodClass.getDeclaredConstructor(new Class[]{Date.class});
result=(RegularTimePeriod)c.newInstance(new Object[]{millisecond});
}
catch ( Exception e2) {
}
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\source\org\jfree\chart\axis\PeriodAxis.java
CATCH CLAUSE : catch (Exception e2) {
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\source\org\jfree\chart\axis\PeriodAxisLabelInfo.java
CATCH CLAUSE : catch (Exception e) {
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\source\org\jfree\chart\axis\SegmentedTimeline.java
CATCH CLAUSE : catch (CloneNotSupportedException e) {
return null;
}
ANTI-PATERN: just returns null instead of handling or re-throwing the exception, swallows the exception, losing the information forever
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\source\org\jfree\chart\ChartPanel.java
CATCH CLAUSE : catch (ClassNotFoundException ex) {
return null;
}
ANTI-PATERN: just returns null instead of handling or re-throwing the exception, swallows the exception, losing the information forever
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\source\org\jfree\chart\ChartPanel.java
CATCH CLAUSE : catch (NoSuchMethodException ex) {
return null;
}
ANTI-PATERN: just returns null instead of handling or re-throwing the exception, swallows the exception, losing the information forever
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\source\org\jfree\chart\ChartPanel.java
CATCH CLAUSE : catch (SecurityException ex) {
return null;
}
ANTI-PATERN: just returns null instead of handling or re-throwing the exception, swallows the exception, losing the information forever
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\source\org\jfree\chart\ChartPanel.java
CATCH CLAUSE : catch (InstantiationException ex) {
return null;
}
ANTI-PATERN: just returns null instead of handling or re-throwing the exception, swallows the exception, losing the information forever
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\source\org\jfree\chart\ChartPanel.java
CATCH CLAUSE : catch (IllegalAccessException ex) {
return null;
}
ANTI-PATERN: just returns null instead of handling or re-throwing the exception, swallows the exception, losing the information forever
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\source\org\jfree\chart\ChartPanel.java
CATCH CLAUSE : catch (IllegalArgumentException ex) {
return null;
}
ANTI-PATERN: just returns null instead of handling or re-throwing the exception, swallows the exception, losing the information forever
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\source\org\jfree\chart\ChartPanel.java
CATCH CLAUSE : catch (InvocationTargetException ex) {
return null;
}
ANTI-PATERN: just returns null instead of handling or re-throwing the exception, swallows the exception, losing the information forever
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\source\org\jfree\chart\encoders\ImageEncoderFactory.java
CATCH CLAUSE : catch (Exception e) {
throw new IllegalArgumentException(e.toString());
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\source\org\jfree\chart\util\PaintAlpha.java
CATCH CLAUSE : catch (Exception e) {
return paint;
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\source\org\jfree\data\general\Series.java
CATCH CLAUSE : catch (PropertyVetoException e) {
throw new IllegalArgumentException(e.getMessage());
}
ANTI-PATTERN: Wrapping the exception and passing getMessage() destroys the stack trace of original exception
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\source\org\jfree\data\jdbc\JDBCCategoryDataset.java
CATCH CLAUSE : catch (Exception e) {
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\source\org\jfree\data\jdbc\JDBCCategoryDataset.java
CATCH CLAUSE : catch (Exception e) {
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\source\org\jfree\data\jdbc\JDBCPieDataset.java
CATCH CLAUSE : catch (Exception e) {
System.err.println("JDBCPieDataset: swallowing exception.");
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\source\org\jfree\data\jdbc\JDBCPieDataset.java
CATCH CLAUSE : catch (Exception e) {
System.err.println("JDBCPieDataset: swallowing exception.");
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\source\org\jfree\data\jdbc\JDBCPieDataset.java
CATCH CLAUSE : catch (Exception e) {
System.err.println("JdbcXYDataset: swallowing exception.");
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\source\org\jfree\data\jdbc\JDBCXYDataset.java
CATCH CLAUSE : catch (Exception e) {
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\source\org\jfree\data\jdbc\JDBCXYDataset.java
CATCH CLAUSE : catch (Exception e) {
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\source\org\jfree\data\jdbc\JDBCXYDataset.java
CATCH CLAUSE : catch (Exception e) {
System.err.println("JdbcXYDataset: swallowing exception.");
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\source\org\jfree\data\KeyToGroupMap.java
CATCH CLAUSE : catch (Exception e) {
e.printStackTrace();
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\source\org\jfree\data\KeyToGroupMap.java
CATCH CLAUSE : catch (Exception e) {
throw new CloneNotSupportedException("Exception.");
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\source\org\jfree\data\time\RegularTimePeriod.java
CATCH CLAUSE : catch (Exception e) {
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\swt\org\jfree\experimental\swt\SWTUtils.java
CATCH CLAUSE : catch (Exception e) {
e.printStackTrace();
color=new java.awt.Color(0,0,0);
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\tests\org\jfree\chart\AreaChartTest.java
CATCH CLAUSE : catch (Exception e) {
fail("There should be no exception.");
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\tests\org\jfree\chart\axis\LogarithmicAxisTest.java
METHOD NAME : setUp() throws Exception
ANTI-PATTERN: Throws generic Exception, defeats the purpose of using a checked exception, declare the specific checked exceptions that your method can throw
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\tests\org\jfree\chart\axis\SegmentedTimelineTest.java
METHOD NAME : setUp() throws Exception
ANTI-PATTERN: Throws generic Exception, defeats the purpose of using a checked exception, declare the specific checked exceptions that your method can throw
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\tests\org\jfree\chart\axis\SubCategoryAxisTest.java
CATCH CLAUSE : catch (Exception e) {
fail("There should be no exception.");
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\tests\org\jfree\chart\BarChart3DTest.java
CATCH CLAUSE : catch (Exception e) {
fail("There should be no exception.");
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\tests\org\jfree\chart\BarChartTest.java
CATCH CLAUSE : catch (Exception e) {
fail("There should be no exception.");
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\tests\org\jfree\chart\GanttChartTest.java
CATCH CLAUSE : catch (Exception e) {
fail("There should be no exception.");
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\tests\org\jfree\chart\plot\CategoryPlotTest.java
CATCH CLAUSE : catch (Exception e) {
fail("No exception should be thrown.");
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\tests\org\jfree\chart\plot\CategoryPlotTest.java
CATCH CLAUSE : catch (Exception e) {
fail("No exception should be thrown.");
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\tests\org\jfree\chart\plot\CategoryPlotTest.java
CATCH CLAUSE : catch (Exception e) {
fail("No exception should be thrown.");
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\tests\org\jfree\chart\plot\PiePlot3DTest.java
CATCH CLAUSE : catch (Exception e) {
success=false;
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\tests\org\jfree\chart\plot\PiePlotTest.java
CATCH CLAUSE : catch (Exception e) {
success=false;
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\tests\org\jfree\chart\plot\SpiderWebPlotTest.java
CATCH CLAUSE : catch (Exception e) {
fail("There should be no exception.");
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\tests\org\jfree\chart\plot\XYPlotTest.java
CATCH CLAUSE : catch (Exception e) {
failed=true;
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\tests\org\jfree\chart\plot\XYPlotTest.java
CATCH CLAUSE : catch (Exception e) {
fail("No exception should be thrown.");
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\tests\org\jfree\chart\plot\XYPlotTest.java
CATCH CLAUSE : catch (Exception e) {
fail("No exception should be thrown.");
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\tests\org\jfree\chart\plot\XYPlotTest.java
CATCH CLAUSE : catch (Exception e) {
fail("No exception should be thrown.");
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\tests\org\jfree\chart\plot\XYPlotTest.java
CATCH CLAUSE : catch (Exception e) {
fail("No exception should be thrown.");
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\tests\org\jfree\chart\plot\XYPlotTest.java
CATCH CLAUSE : catch (Exception e) {
fail("No exception should be thrown.");
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\tests\org\jfree\chart\renderer\category\BoxAndWhiskerRendererTest.java
CATCH CLAUSE : catch (Exception e) {
success=false;
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\tests\org\jfree\chart\renderer\category\BoxAndWhiskerRendererTest.java
CATCH CLAUSE : catch (Exception e) {
success=false;
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\tests\org\jfree\chart\renderer\category\BoxAndWhiskerRendererTest.java
CATCH CLAUSE : catch (Exception e) {
success=false;
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\tests\org\jfree\chart\renderer\category\BoxAndWhiskerRendererTest.java
CATCH CLAUSE : catch (Exception e) {
success=false;
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\tests\org\jfree\chart\renderer\category\BoxAndWhiskerRendererTest.java
CATCH CLAUSE : catch (Exception e) {
success=false;
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\tests\org\jfree\chart\renderer\category\BoxAndWhiskerRendererTest.java
CATCH CLAUSE : catch (Exception e) {
success=false;
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\tests\org\jfree\chart\renderer\category\BoxAndWhiskerRendererTest.java
CATCH CLAUSE : catch (Exception e) {
success=false;
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\tests\org\jfree\chart\renderer\category\BoxAndWhiskerRendererTest.java
CATCH CLAUSE : catch (Exception e) {
fail("No exception should be thrown.");
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\tests\org\jfree\chart\renderer\category\BoxAndWhiskerRendererTest.java
CATCH CLAUSE : catch (Exception e) {
success=false;
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\tests\org\jfree\chart\renderer\category\BoxAndWhiskerRendererTest.java
CATCH CLAUSE : catch (Exception e) {
success=false;
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\tests\org\jfree\chart\renderer\xy\StackedXYAreaRenderer2Test.java
CATCH CLAUSE : catch (Exception e) {
success=false;
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\tests\org\jfree\chart\renderer\xy\XYBoxAndWhiskerRendererTest.java
CATCH CLAUSE : catch (Exception e) {
fail("No exception should be thrown.");
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\tests\org\jfree\chart\ScatterPlotTest.java
CATCH CLAUSE : catch (Exception e) {
fail("No exception should be thrown.");
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\tests\org\jfree\chart\StackedAreaChartTest.java
CATCH CLAUSE : catch (Exception e) {
fail("There should be no exception.");
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\tests\org\jfree\chart\StackedBarChart3DTest.java
CATCH CLAUSE : catch (Exception e) {
fail("There should be no exception.");
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\tests\org\jfree\chart\StackedBarChartTest.java
CATCH CLAUSE : catch (Exception e) {
fail("There should be no exception.");
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\tests\org\jfree\chart\TimeSeriesChartTest.java
CATCH CLAUSE : catch (Exception e) {
fail("No exception should be triggered.");
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\tests\org\jfree\chart\util\RelativeDateFormatTest.java
METHOD NAME : setUp() throws Exception
ANTI-PATTERN: Throws generic Exception, defeats the purpose of using a checked exception, declare the specific checked exceptions that your method can throw
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\tests\org\jfree\chart\util\RelativeDateFormatTest.java
METHOD NAME : tearDown() throws Exception
ANTI-PATTERN: Throws generic Exception, defeats the purpose of using a checked exception, declare the specific checked exceptions that your method can throw
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\tests\org\jfree\chart\WaterfallChartTest.java
CATCH CLAUSE : catch (Exception e) {
fail("There should be no exception.");
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\tests\org\jfree\chart\XYAreaChartTest.java
CATCH CLAUSE : catch (Exception e) {
fail("No exception should be triggered.");
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\tests\org\jfree\chart\XYBarChartTest.java
CATCH CLAUSE : catch (Exception e) {
fail("No exception should be triggered.");
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\tests\org\jfree\chart\XYLineChartTest.java
CATCH CLAUSE : catch (Exception e) {
fail("No exception should be triggered.");
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\tests\org\jfree\chart\XYStepAreaChartTest.java
CATCH CLAUSE : catch (Exception e) {
fail("No exception should be triggered.");
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\tests\org\jfree\chart\XYStepChartTest.java
CATCH CLAUSE : catch (Exception e) {
fail("No exception should be triggered.");
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\tests\org\jfree\data\RangeTest.java
CATCH CLAUSE : catch (Exception e) {
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\tests\org\jfree\data\RangeTest.java
CATCH CLAUSE : catch (Exception e) {
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\tests\org\jfree\data\RangeTest.java
CATCH CLAUSE : catch (Exception e) {
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\tests\org\jfree\data\RangeTest.java
CATCH CLAUSE : catch (Exception e) {
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\tests\org\jfree\data\RangeTest.java
CATCH CLAUSE : catch (Exception e) {
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\tests\org\jfree\data\time\TimeSeriesTest.java
CATCH CLAUSE : catch (Exception e) {
fail("No exceptions should be thrown.");
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
_________________________________________________________________________________
FILE NAME : JFreeChart\jfreechart-1.0.17\tests\org\jfree\data\time\TimeSeriesTest.java
CATCH CLAUSE : catch (Exception e) {
pass=false;
}
ANTI-PATTERN : catching generic Exception, catch the specific exception that can be thrown
_________________________________________________________________________________
EXPERIMENTAL RESULTS
NUMBER OF JAVA FILES :990
NUMBER OF CATCH CLAUSES :420
NUMBER OF METHOD DECLARATIONS :11516
NUMBER OF THROW PRINTSTACKTRACE ANTIPATTERN:0
NUMBER OF THROW LOG ANTIPATTERN:0
NUMBER OF CATCH ALL ANTIPATTERN:64
NUMBER OF RETURN NULL LOG ANTIPATTERN:0
NUMBER OF RETURN NULL PRINTSTACKTRACE ANTIPATTERN:0
NUMBER OF MULTI-LINE LOG ANTIPATTERN:0
NUMBER OF CATCH-AND-IGNORE ANTIPATTERN:8
NUMBER OF THROWS EXCEPTION ANTIPATTERN:4
NUMBER OF DESTRUCTIVE WRAPPING ANTIPATTERN:1
NUMBER OF RELYING ON GETCAUSE ANTIPATTERN:0
List of Exception Management Anti-Patterns and Code Smells
-
- Posts: 1
- Joined: Sun Jun 29, 2014 10:48 am
- antibot: No, of course not.
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Re: List of Exception Management Anti-Patterns and Code Smel
Thanks for the analysis. Along similar lines, there is a SonarQube report that I keep an eye on:
http://nemo.sonarqube.org/dashboard/index/143547
http://nemo.sonarqube.org/dashboard/index/143547
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program