1120-1-2

if (chart == null) { throw new IllegalArgumentException("Null 'chart' argument."); } BufferedImage image = chart.createBufferedImage(width, height, BufferedImage.TYPE_INT_RGB, info); EncoderUtil.writeBufferedImage(image, ImageFormat.JPEG, out);
if (chart == null) { throw new IllegalArgumentException("Null 'chart' argument."); } BufferedImage image = chart.createBufferedImage(width, height, BufferedImage.TYPE_INT_RGB, info); EncoderUtil.writeBufferedImage(image, ImageFormat.JPEG, out, quality);

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 writeChartAsJPEG(OutputStream, JFreeChart, int, int, ChartRenderingInfo)` |  | Method name: `void writeChartAsJPEG(OutputStream, float, JFreeChart, int, int, ChartRenderingInfo)`
Number of AST nodes: 4 |  | Number of AST nodes: 4

1

    if (chart == null) {↵

1

    if (chart == null) {↵

2

                throw new IllegalArgumentException("Null 'chart' argument.");↵

2

                throw new IllegalArgumentException("Null 'chart' argument.");↵

3

            }↵

3

            }↵

4

            BufferedImage image = chart.createBufferedImage(width, height, ↵

4

            BufferedImage image = chart.createBufferedImage(width, height, ↵

5

                    BufferedImage.TYPE_INT_RGB, info);↵

5

                    BufferedImage.TYPE_INT_RGB, info);↵

6

            EncoderUtil.writeBufferedImage(image, ImageFormat.JPEG, out);

6

            EncoderUtil.writeBufferedImage(image, ImageFormat.JPEG, out, quality);

See real code fragment |  | See real code fragment

Summary
Number of common nesting structure subtrees | 1
Number of refactorable cases | 0
Number of non-refactorable cases | 1
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.1
Clones location | Clones are declared in the same class
Number of node comparisons | 8

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 4
   Number of unmapped statements in the first code fragment | 0
   Number of unmapped statements in the second code fragment | 0
   Time elapsed for statement mapping (ms) | 1.1
   Clone type | Type 2

   Mapped Statements
   ID | Statement |  | ID | Statement
   --- | --- | --- | --- | ---

   1

       if (chart == null)

   1

       if (chart == null)

   2

       throw new IllegalArgumentException("Null 'chart' argument.");

   2

       throw new IllegalArgumentException("Null 'chart' argument.");

   3

       BufferedImage image = chart.createBufferedImage(width, height, BufferedImage.TYPE_INT_RGB, info);

   3

       BufferedImage image = chart.createBufferedImage(width, height, BufferedImage.TYPE_INT_RGB, info);

   4

       EncoderUtil.writeBufferedImage(image, ImageFormat.JPEG, out);

   4 | EncoderUtil.writeBufferedImage(image, ImageFormat.JPEG, out);
   4 | EncoderUtil.writeBufferedImage(image, ImageFormat.JPEG, out, quality);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   EncoderUtil.writeBufferedImage(image,ImageFormat.JPEG,out) | EncoderUtil.writeBufferedImage(image,ImageFormat.JPEG,out,quality) | ARGUMENT_NUMBER_MISMATCH

   Preondition Violations
   Expression EncoderUtil.writeBufferedImage(image,ImageFormat.JPEG,out) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression EncoderUtil.writeBufferedImage(image,ImageFormat.JPEG,out,quality) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression EncoderUtil.writeBufferedImage(image,ImageFormat.JPEG,out) is a void method call, and thus it cannot be parameterized
   Expression EncoderUtil.writeBufferedImage(image,ImageFormat.JPEG,out,quality) is a void method call, and thus it cannot be parameterized

   4

       EncoderUtil.writeBufferedImage(image, ImageFormat.JPEG, out, quality);

   Precondition Violations (4)
   Row | Violation
   --- | ---
   1 | Expression EncoderUtil.writeBufferedImage(image,ImageFormat.JPEG,out) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   2 | Expression EncoderUtil.writeBufferedImage(image,ImageFormat.JPEG,out,quality) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   3 | Expression EncoderUtil.writeBufferedImage(image,ImageFormat.JPEG,out) is a void method call, and thus it cannot be parameterized
   4 | Expression EncoderUtil.writeBufferedImage(image,ImageFormat.JPEG,out,quality) is a void method call, and thus it cannot be parameterized