try {
File f = new File(file);
is = new FileInputStream(f);
p.load(is);
} catch (IOException e) {
try {
is =
ClassLoader.getSystemResourceAsStream("org/apache/jmeter/jmeter.properties"); // $NON-NLS-1$
if (is == null) {
throw new RuntimeException("Could not read JMeter properties file");
}
p.load(is);
} catch (IOException ex) {
// JMeter.fail("Could not read internal resource. " +
// "Archive is broken.");
}
} finally {
JOrphanUtils.closeQuietly(is);
}
Writer writer = null;
try {
if (encoding == null) {
writer = new FileWriter(this);
} else {
writer = new OutputStreamWriter(new FileOutputStream(this), encoding);
}
writer.write(body);
writer.flush();
} catch (IOException ioe) {
log.error("", ioe);
} finally {
JOrphanUtils.closeQuietly(writer);
}
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/util/JMeterUtils.java
|
|
File path: /jakarta-jmeter-2.3.2/src/org/apache/jorphan/io/TextFile.java
|
Method name: void loadJMeterProperties(String)
|
|
Method name: void setText(String)
|
Number of AST nodes: 4
|
|
Number of AST nodes: 7
|
|
1 | try {↵ | | |
|
2 | File f = new File(file);↵ | | |
|
3 | is = new FileInputStream(f);↵ | | |
|
4 | p.load(is);↵ | | |
|
5 | } catch (IOException e) {↵ | | |
|
6 | try {↵ | | |
|
7 | is = ↵ | | |
|
8 | ClassLoader.getSystemResourceAsStream("org/apache/jmeter/jmeter.properties"); // $NON-NLS-1$↵ | | |
|
9 | if (is == null) {↵ | | |
|
10 | throw new RuntimeException("Could not read JMeter properties file"↵ | | 1 | Writer writer = null;↵
|
| | | 2 | try {↵
|
| | | 3 | if (encoding == null) {↵
|
| | | 4 | writer = new FileWriter(this);↵
|
| | | 5 | } else {↵
|
11 | );↵ | | 6 | writer = new OutputStreamWriter(new FileOutputStream(this), encoding);↵
|
12 | }↵ | | 7 | }↵
|
13 | p.load(is↵ | | 8 | writer.write(body);↵
|
14 | );↵ | | 9 | writer.flush();↵
|
15 | } catch (IOException ex) {↵ | | 10 | } catch (IOException ioe) {↵
|
16 | // JMeter.fail("Could not read internal resource. " +↵ | | 11 | ↵
|
17 | // "Archive is broken.");↵ | | |
|
18 | }↵ | | 12 | log.error("", ioe);↵
|
19 | } finally {↵ | | 13 | } finally {↵
|
20 | JOrphanUtils.closeQuietly(is); ↵ | | 14 | JOrphanUtils.closeQuietly(writer);↵
|
21 | } | | 15 | }
|
See real code fragment |
|
See real code fragment |
Summary
Number of common nesting structure subtrees | 0 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.0 |
Clones location | Clones are in different classes |
Number of node comparisons | 1 |