if(provider != null) { try { return MessageDigest.getInstance(providerName, provider); } catch(NoSuchAlgorithmException e) { // bouncy castle doesn't support algorithm } }
if (!Ruby.isSecurityRestricted()) { try { Method.setAccessible(this.ctors, true); } catch(SecurityException e) {} }
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/RubyDigest.java File path: /jruby-1.4.0/src/org/jruby/java/invokers/ConstructorInvoker.java
Method name: MessageDigest createMessageDigest(Ruby, String) Method name: void ConstructorInvoker(RubyModule, List)
Number of AST nodes: 3 Number of AST nodes: 3
1
if(provider != null) {
1
if (!Ruby.isSecurityRestricted()) {
2
            try {
2
            try {
3
                return MessageDigest.getInstance(providerName, provider);
3
                Method.setAccessible(this.ctors, true);
4
            } catch(NoSuchAlgorithmException e) {
4
            } catch(SecurityException e) {
5
                // bouncy castle doesn't support algorithm
6
            }
5
}
7
        }
6
        }
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.2
Clones locationClones are in different classes
Number of node comparisons5
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)0.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    2
    try
    2
    try
    4
    try
    Differences
    Expression1Expression2Difference
    java.security.NoSuchAlgorithmExceptionjava.lang.SecurityExceptionSUBCLASS_TYPE_MISMATCH
    java.security.NoSuchAlgorithmExceptionjava.lang.SecurityExceptionSUBCLASS_TYPE_MISMATCH
    4
    try
    3
    return MessageDigest.getInstance(providerName, provider);
    3
    return MessageDigest.getInstance(providerName, provider);
    Preondition Violations
    Unmatched statement return MessageDigest.getInstance(providerName,provider); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    Unmatched return MessageDigest.getInstance(providerName,provider);
                                                                                                                          
                                                                                      
    5
    Method.setAccessible(this.ctors, true);
    Preondition Violations
    Unmatched statement Method.setAccessible(this.ctors,true); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    5
    Method.setAccessible(this.ctors, true);
    Precondition Violations (3)
    Row Violation
    1Unmatched statement return MessageDigest.getInstance(providerName,provider); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    2Unmatched return MessageDigest.getInstance(providerName,provider);
    3Unmatched statement Method.setAccessible(this.ctors,true); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted