boolean success = false; try { BufferedImage image = new BufferedImage(200 , 100, BufferedImage.TYPE_INT_RGB); Graphics2D g2 = image.createGraphics(); this.chart.draw(g2, new Rectangle2D.Double(0, 0, 200, 100), null, null); g2.dispose(); success = true; } catch (Exception e) { success = false; } assertTrue(success);
boolean success = false; try { BufferedImage image = new BufferedImage(200 , 100, BufferedImage.TYPE_INT_RGB); Graphics2D g2 = image.createGraphics(); this.chart.draw(g2, new Rectangle2D.Double(0, 0, 200, 100), null, null); g2.dispose(); success = true; } catch (Exception e) { success = false; e.printStackTrace(); } assertTrue(success);
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/chart/junit/GanttChartTests.java File path: /jfreechart-1.0.10/tests/org/jfree/chart/junit/XYStepAreaChartTests.java
Method name: void testDrawWithNullInfo() Method name: void testDrawWithNullInfo()
Number of AST nodes: 8 Number of AST nodes: 8
1
boolean success = false;
1
boolean success = false;
2
        try {
2
        try {
3
            BufferedImage image = new BufferedImage(200 , 100, 
3
            BufferedImage image = new BufferedImage(200 , 100, 
4
                    BufferedImage.TYPE_INT_RGB);
4
                    BufferedImage.TYPE_INT_RGB);
5
            Graphics2D g2 = image.createGraphics();
5
            Graphics2D g2 = image.createGraphics();
6
            this.chart.draw(g2, new Rectangle2D.Double(0, 0, 200, 100), null, 
6
            this.chart.draw(g2, new Rectangle2D.Double(0, 0, 200, 100), null, 
7
                    null);
7
                    null);
8
            g2.dispose();
8
            g2.dispose();
9
            success = true;
9
            success = true;
10
        }
10
        }
11
        catch (Exception e) {
11
        catch (Exception e) {
12
            success = false;
12
          success = false;
13
          e.printStackTrace();
13
        }
14
        }
14
        assertTrue(success);
15
        assertTrue(success);
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.1
Clones locationClones are in different classes having the same super class
Number of node comparisons5
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment6
    Number of unmapped statements in the second code fragment6
    Time elapsed for statement mapping (ms)1.5
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    boolean success = false;
    1
    boolean success = false;
                
    2
    try
                                                                                                                                                              
    3
    BufferedImage image = new BufferedImage(200, 100, BufferedImage.TYPE_INT_RGB);
    Preondition Violations
    Unmatched statement BufferedImage image=new BufferedImage(200,100,BufferedImage.TYPE_INT_RGB); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3
    BufferedImage image = new BufferedImage(200, 100, BufferedImage.TYPE_INT_RGB);
                                                                                    
    4
    Graphics2D g2 = image.createGraphics();
                                                                                                                                              
    5
    this.chart.draw(g2, new Rectangle2D.Double(0, 0, 200, 100), null, null);
    Preondition Violations
    Unmatched statement this.chart.draw(g2,new Rectangle2D.Double(0,0,200,100),null,null); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5
    this.chart.draw(g2, new Rectangle2D.Double(0, 0, 200, 100), null, null);
                                    
    6
    g2.dispose();
                                    
    7
    success = true;
    Preondition Violations
    Unmatched statement success=true; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7
    success = true;
    2
    try
                
    3
    BufferedImage image = new BufferedImage(200, 100, BufferedImage.TYPE_INT_RGB);
    3
    BufferedImage image = new BufferedImage(200, 100, BufferedImage.TYPE_INT_RGB);
    Preondition Violations
    Unmatched statement BufferedImage image=new BufferedImage(200,100,BufferedImage.TYPE_INT_RGB); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                                                                                              
    4
    Graphics2D g2 = image.createGraphics();
                                                                                    
    5
    this.chart.draw(g2, new Rectangle2D.Double(0, 0, 200, 100), null, null);
    5
    this.chart.draw(g2, new Rectangle2D.Double(0, 0, 200, 100), null, null);
    Preondition Violations
    Unmatched statement this.chart.draw(g2,new Rectangle2D.Double(0,0,200,100),null,null); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                                                                              
    6
    g2.dispose();
                                    
    7
    success = true;
    7
    success = true;
    Preondition Violations
    Unmatched statement success=true; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                    
    8
    assertTrue(success);
    8
    assertTrue(success);
    Precondition Violations (6)
    Row Violation
    1Unmatched statement BufferedImage image=new BufferedImage(200,100,BufferedImage.TYPE_INT_RGB); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    2Unmatched statement this.chart.draw(g2,new Rectangle2D.Double(0,0,200,100),null,null); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3Unmatched statement success=true; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement BufferedImage image=new BufferedImage(200,100,BufferedImage.TYPE_INT_RGB); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5Unmatched statement this.chart.draw(g2,new Rectangle2D.Double(0,0,200,100),null,null); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    6Unmatched statement success=true; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted