if (!resource.getErrors().isEmpty() || !resource.getWarnings().isEmpty()) { BasicDiagnostic basicDiagnostic = new BasicDiagnostic (Diagnostic.ERROR, "org.eclipse.emf.mapping.ecore2xml.edit", //$NON-NLS-1$ 0, getString("_UI_CreateModelError_message", resource.getURI()), //$NON-NLS-1$ new Object [] { exception == null ? (Object)resource : exception }); basicDiagnostic.merge(EcoreUtil.computeDiagnostic(resource, true)); return basicDiagnostic; } else if (exception != null) { return new BasicDiagnostic (Diagnostic.ERROR, "org.eclipse.emf.mapping.ecore2xml.edit", //$NON-NLS-1$ 0, getString("_UI_CreateModelError_message", resource.getURI()), //$NON-NLS-1$ new Object[] { exception }); } else { return Diagnostic.OK_INSTANCE; }
if (!resource.getErrors().isEmpty() || !resource.getWarnings().isEmpty()) { BasicDiagnostic basicDiagnostic = new BasicDiagnostic (Diagnostic.ERROR, "org.eclipse.emf.ecore.editor", 0, getString("_UI_CreateModelError_message", resource.getURI()), new Object [] { exception == null ? (Object)resource : exception }); basicDiagnostic.merge(EcoreUtil.computeDiagnostic(resource, true)); return basicDiagnostic; } else if (exception != null) { return new BasicDiagnostic (Diagnostic.ERROR, "org.eclipse.emf.ecore.editor", 0, getString("_UI_CreateModelError_message", resource.getURI()), new Object[] { exception }); } else { return Diagnostic.OK_INSTANCE; }
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/mapping/ecore2xml/presentation/Ecore2XMLEditor.java File path: /emf-2.4.1/src/org/eclipse/emf/ecore/presentation/EcoreEditor.java
Method name: Diagnostic analyzeResourceProblems(Resource, Exception) Method name: Diagnostic analyzeResourceProblems(Resource, Exception)
Number of AST nodes: 7 Number of AST nodes: 7
1
if (!resource.getErrors().isEmpty() || !resource.getWarnings().isEmpty())
1
if (!resource.getErrors().isEmpty() || !resource.getWarnings().isEmpty())
2
    {
2
    {
3
      BasicDiagnostic basicDiagnostic =
3
      BasicDiagnostic basicDiagnostic =
4
        new BasicDiagnostic
4
        new BasicDiagnostic
5
          (Diagnostic.ERROR,
5
          (Diagnostic.ERROR,
6
           "org.eclipse.emf.mapping.ecore2xml.edit", //$NON-NLS-1$
6
           "org.eclipse.emf.ecore.editor",
7
           0,
7
           0,
8
           getString("_UI_CreateModelError_message", resource.getURI()), //$NON-NLS-1$
8
           getString("_UI_CreateModelError_message", resource.getURI()),
9
           new Object [] { exception == null ? (Object)resource : exception });
9
           new Object [] { exception == null ? (Object)resource : exception });
10
      basicDiagnostic.merge(EcoreUtil.computeDiagnostic(resource, true));
10
      basicDiagnostic.merge(EcoreUtil.computeDiagnostic(resource, true));
11
      return basicDiagnostic;
11
      return basicDiagnostic;
12
    }
12
    }
13
    else if (exception != null)
13
    else if (exception != null)
14
    {
14
    {
15
      return
15
      return
16
        new BasicDiagnostic
16
        new BasicDiagnostic
17
          (Diagnostic.ERROR,
17
          (Diagnostic.ERROR,
18
           "org.eclipse.emf.mapping.ecore2xml.edit", //$NON-NLS-1$
18
           "org.eclipse.emf.ecore.editor",
19
           0,
19
           0,
20
           getString("_UI_CreateModelError_message", resource.getURI()), //$NON-NLS-1$
20
           getString("_UI_CreateModelError_message", resource.getURI()),
21
           new Object[] { exception });
21
           new Object[] { exception });
22
    }
22
    }
23
    else
23
    else
24
    {
24
    {
25
      return Diagnostic.OK_INSTANCE;
25
      return Diagnostic.OK_INSTANCE;
26
    }
26
    }
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.7
Clones locationClones are in different classes having the same super class
Number of node comparisons38
  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)2.4
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (!resource.getErrors().isEmpty() || !resource.getWarnings().isEmpty())
    1
    if (!resource.getErrors().isEmpty() || !resource.getWarnings().isEmpty())
    2
    BasicDiagnostic basicDiagnostic = new BasicDiagnostic(Diagnostic.ERROR, "org.eclipse.emf.mapping.ecore2xml.edit", 0, getString("_UI_CreateModelError_message", resource.getURI()), new Object[] {exception == null ? (Object)resource : exception});
    2
    BasicDiagnostic basicDiagnostic = new BasicDiagnostic(Diagnostic.ERROR, "org.eclipse.emf.mapping.ecore2xml.edit", 0, getString("_UI_CreateModelError_message", resource.getURI()), new Object[] {exception == null ? (Object)resource : exception});
    2
    BasicDiagnostic basicDiagnostic = new BasicDiagnostic(Diagnostic.ERROR, "org.eclipse.emf.ecore.editor", 0, getString("_UI_CreateModelError_message", resource.getURI()), new Object[] {exception == null ? (Object)resource : exception});
    Differences
    Expression1Expression2Difference
    "org.eclipse.emf.mapping.ecore2xml.edit""org.eclipse.emf.ecore.editor"LITERAL_VALUE_MISMATCH
    2
    BasicDiagnostic basicDiagnostic = new BasicDiagnostic(Diagnostic.ERROR, "org.eclipse.emf.ecore.editor", 0, getString("_UI_CreateModelError_message", resource.getURI()), new Object[] {exception == null ? (Object)resource : exception});
    3
    basicDiagnostic.merge(EcoreUtil.computeDiagnostic(resource, true));
    3
    basicDiagnostic.merge(EcoreUtil.computeDiagnostic(resource, true));
    4
    return basicDiagnostic;
    4
    return basicDiagnostic;
    5
    else if (exception != null)
    5
    else if (exception != null)
    6
    return new BasicDiagnostic(Diagnostic.ERROR, "org.eclipse.emf.mapping.ecore2xml.edit", 0, getString("_UI_CreateModelError_message", resource.getURI()), new Object[] {exception});
    6
    return new BasicDiagnostic(Diagnostic.ERROR, "org.eclipse.emf.mapping.ecore2xml.edit", 0, getString("_UI_CreateModelError_message", resource.getURI()), new Object[] {exception});
    6
    return new BasicDiagnostic(Diagnostic.ERROR, "org.eclipse.emf.ecore.editor", 0, getString("_UI_CreateModelError_message", resource.getURI()), new Object[] {exception});
    Differences
    Expression1Expression2Difference
    "org.eclipse.emf.mapping.ecore2xml.edit""org.eclipse.emf.ecore.editor"LITERAL_VALUE_MISMATCH
    6
    return new BasicDiagnostic(Diagnostic.ERROR, "org.eclipse.emf.ecore.editor", 0, getString("_UI_CreateModelError_message", resource.getURI()), new Object[] {exception});
    else
    else
    7
    return Diagnostic.OK_INSTANCE;
    7
    return Diagnostic.OK_INSTANCE;
    Precondition Violations (0)
    Row Violation