if (file == null) { throw new IllegalArgumentException("Null 'file' argument."); } if (chart == null) { throw new IllegalArgumentException("Null 'chart' argument."); } OutputStream out = new BufferedOutputStream(new FileOutputStream(file)); try { writeChartAsPNG(out, chart, width, height, info, encodeAlpha, compression); } finally { out.close(); }
if (file == null) { throw new IllegalArgumentException("Null 'file' argument."); } if (chart == null) { throw new IllegalArgumentException("Null 'chart' argument."); } OutputStream out = new BufferedOutputStream(new FileOutputStream( file)); try { writeChartAsJPEG(out, quality, chart, width, height, info); } finally { out.close(); }
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/ChartUtilities.java File path: /jfreechart-1.0.10/src/org/jfree/chart/ChartUtilities.java
Method name: void saveChartAsPNG(File, JFreeChart, int, int, ChartRenderingInfo, boolean, int) Method name: void saveChartAsJPEG(File, float, JFreeChart, int, int, ChartRenderingInfo)
Number of AST nodes: 7 Number of AST nodes: 7
1
if (file == null) {
1
if (file == null) {
2
            throw new IllegalArgumentException("Null 'file' argument.");
2
            throw new IllegalArgumentException("Null 'file' argument.");
3
        }
3
        }
4
        if (chart == null) {
4
        if (chart == null) {
5
            throw new IllegalArgumentException("Null 'chart' argument.");
5
            throw new IllegalArgumentException("Null 'chart' argument.");
6
        }
6
        }
7
        
7
        OutputStream out = new BufferedOutputStream(new FileOutputStream(
8
        OutputStream out = new BufferedOutputStream(new FileOutputStream(
8
file));
9
                file));
9
        try {
10
        try {
10
            writeChartAsPNG(out, chart, width, height, info, encodeAlpha, 
11
            writeChartAsJPEG(out, quality, chart, width, height, info
11
                    compression);
12
);
12
        }
13
        }
13
        finally {
14
        finally {
14
            out.close();
15
            out.close();
15
        }
16
        }
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.4
Clones locationClones are declared in the same class
Number of node comparisons22
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements7
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)7.9
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (file == null)
    1
    if (file == null)
    2
    throw new IllegalArgumentException("Null 'file' argument.");
    2
    throw new IllegalArgumentException("Null 'file' argument.");
    3
    if (chart == null)
    3
    if (chart == null)
    4
    throw new IllegalArgumentException("Null 'chart' argument.");
    4
    throw new IllegalArgumentException("Null 'chart' argument.");
    5
    OutputStream out = new BufferedOutputStream(new FileOutputStream(file));
    5
    OutputStream out = new BufferedOutputStream(new FileOutputStream(file));
    6
    try
    6
    try
    7
    writeChartAsPNG(out, chart, width, height, info, encodeAlpha, compression);
    7
    writeChartAsPNG(out, chart, width, height, info, encodeAlpha, compression);
    7
    writeChartAsJPEG(out, quality, chart, width, height, info);
    Differences
    Expression1Expression2Difference
    writeChartAsPNGwriteChartAsJPEGMETHOD_INVOCATION_NAME_MISMATCH
    writeChartAsPNG(out,chart,width,height,info,encodeAlpha,compression)writeChartAsJPEG(out,quality,chart,width,height,info)ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression writeChartAsPNG(out,chart,width,height,info,encodeAlpha,compression) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression writeChartAsJPEG(out,quality,chart,width,height,info) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression writeChartAsPNG(out,chart,width,height,info,encodeAlpha,compression) is a void method call, and thus it cannot be parameterized
    Expression writeChartAsJPEG(out,quality,chart,width,height,info) is a void method call, and thus it cannot be parameterized
    Expression writeChartAsPNG(out,chart,width,height,info,encodeAlpha,compression) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression writeChartAsJPEG(out,quality,chart,width,height,info) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression writeChartAsPNG(out,chart,width,height,info,encodeAlpha,compression) is a void method call, and thus it cannot be parameterized
    Expression writeChartAsJPEG(out,quality,chart,width,height,info) is a void method call, and thus it cannot be parameterized
    7
    writeChartAsJPEG(out, quality, chart, width, height, info);
    Precondition Violations (8)
    Row Violation
    1Expression writeChartAsPNG(out,chart,width,height,info,encodeAlpha,compression) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression writeChartAsJPEG(out,quality,chart,width,height,info) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression writeChartAsPNG(out,chart,width,height,info,encodeAlpha,compression) is a void method call, and thus it cannot be parameterized
    4Expression writeChartAsJPEG(out,quality,chart,width,height,info) is a void method call, and thus it cannot be parameterized
    5Expression writeChartAsPNG(out,chart,width,height,info,encodeAlpha,compression) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression writeChartAsJPEG(out,quality,chart,width,height,info) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression writeChartAsPNG(out,chart,width,height,info,encodeAlpha,compression) is a void method call, and thus it cannot be parameterized
    8Expression writeChartAsJPEG(out,quality,chart,width,height,info) is a void method call, and thus it cannot be parameterized