if (provider != null) { try { messageDigest = MessageDigest.getInstance(algorithm, provider); } catch (NoSuchAlgorithmException noalgo) { throw new BuildException(noalgo, getLocation()); } catch (NoSuchProviderException noprovider) { throw new BuildException(noprovider, getLocation()); } } else { try { messageDigest = MessageDigest.getInstance(algorithm); } catch (NoSuchAlgorithmException noalgo) { throw new BuildException(noalgo, getLocation()); } }
if ((provider != null) && !"".equals(provider) && !"null".equals(provider)) { try { messageDigest = MessageDigest.getInstance(algorithm, provider); } catch (NoSuchAlgorithmException noalgo) { throw new BuildException(noalgo); } catch (NoSuchProviderException noprovider) { throw new BuildException(noprovider); } } else { try { messageDigest = MessageDigest.getInstance(algorithm); } catch (NoSuchAlgorithmException noalgo) { throw new BuildException(noalgo); } }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/Checksum.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/selectors/modifiedselector/DigestAlgorithm.java
Method name: boolean validateAndExecute() Method name: void initMessageDigest()
Number of AST nodes: 5 Number of AST nodes: 5
1
if (provider != null) {
1
if ((provider != null) && !"".equals(provider) && !"null".equals(provider)) {
2
            try {
2
            try {
3
                messageDigest = MessageDigest.getInstance(algorithm, provider);
3
                messageDigest = MessageDigest.getInstance(algorithm, provider);
4
            } catch (NoSuchAlgorithmException noalgo) {
4
            } catch (NoSuchAlgorithmException noalgo) {
5
                throw new BuildException(noalgo, getLocation());
5
                throw new BuildException(noalgo);
6
            } catch (NoSuchProviderException noprovider) {
6
            } catch (NoSuchProviderException noprovider) {
7
                throw new BuildException(noprovider, getLocation());
7
                throw new BuildException(noprovider);
8
            }
8
            }
9
        } else {
9
        } else {
10
            try {
10
            try {
11
                messageDigest = MessageDigest.getInstance(algorithm);
11
                messageDigest = MessageDigest.getInstance(algorithm);
12
            } catch (NoSuchAlgorithmException noalgo) {
12
            } catch (NoSuchAlgorithmException noalgo) {
13
                throw new BuildException(noalgo, getLocation());
13
                throw new BuildException(noalgo);
14
            }
14
            }
15
        }
15
        }
Summary
Number of common nesting structure subtrees2
Number of refactorable cases2
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.5
Clones locationClones are in different classes
Number of node comparisons11
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    30
    try
    30
    try
    4
    try
    Differences
    Expression1Expression2Difference
    new BuildException(noalgo,getLocation())new BuildException(noalgo)ARGUMENT_NUMBER_MISMATCH
    new BuildException(noprovider,getLocation())new BuildException(noprovider)ARGUMENT_NUMBER_MISMATCH
    4
    try
    31
    messageDigest = MessageDigest.getInstance(algorithm, provider);
    5
    messageDigest = MessageDigest.getInstance(algorithm, provider);
    Precondition Violations (0)
    Row Violation
  2. {Refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.4
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    32
    try
    32
    try
    6
    try
    Differences
    Expression1Expression2Difference
    new BuildException(noalgo,getLocation())new BuildException(noalgo)ARGUMENT_NUMBER_MISMATCH
    6
    try
    33
    messageDigest = MessageDigest.getInstance(algorithm);
    7
    messageDigest = MessageDigest.getInstance(algorithm);
    Precondition Violations (0)
    Row Violation