File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/PatternSet.java | File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/PatternSet.java | |||
Method name: void append(PatternSet, Project)
|
Method name: void setExcludes(String)
|
|||
Number of AST nodes: 2 | Number of AST nodes: 2 | |||
1 | /** | 1 | /** | |
2 | * Adds the patterns of the other instance to this set. | 2 | * Appends <code>excludes</code> to the current list of exclude patterns. | |
3 | * @param other the other PatternSet instance. | 3 | * Patterns may be separated by a comma or a space. | |
4 | * @param p the current project. | 4 | * | |
5 | */ | 5 | * @param excludes the string containing the exclude patterns | |
6 | public void append(PatternSet other, Project p) { | 6 | */ | |
7 | if (isReference()) { | 7 | public void setExcludes(String excludes) { | |
8 | throw new BuildException("Cannot append to a reference"); | 8 | if (isReference()) { | |
9 | } | 9 | throw tooManyAttributes(); | |
10 | 10 | } | ||
11 | String[] incl = other.getIncludePatterns(p); | 11 | if (excludes != null && excludes.length() > 0) { | |
12 | if (incl != null) { | 12 | StringTokenizer tok = new StringTokenizer(excludes, ", ", false); | |
13 | for (int i = 0; i < incl.length; i++) { | 13 | while (tok.hasMoreTokens()) { | |
14 | createInclude().setName(incl[i]); | 14 | createExclude().setName(tok.nextToken()); | |
15 | } | 15 | } | |
16 | } | 16 | } | |
17 | 17 | } | ||
18 | String[] excl = other.getExcludePatterns(p); | |||
19 | if (excl != null) { | |||
20 | for (int i = 0; i < excl.length; i++) { | |||
21 | createExclude().setName(excl[i]); | |||
22 | } | |||
23 | } | |||
24 | } | |||
See real code fragment | See real code fragment |
Number of mapped statements | 3 |
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) | 0.0 |
Similarity Score | 0.667 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
9 | for (int i = 0; i < excl.length; i++) |
| 5 | while (tok.hasMoreTokens()) | ||||||||||||||||||
10 | createExclude().setName(excl[i]); |
| 6 | createExclude().setName(tok.nextToken()); |
Row | Violation |
---|---|
1 | Type java.lang.String[] of variable excl does not match with type java.lang.String of variable excludes |
2 | Type java.lang.String[] of variable excl does not match with type java.lang.String of variable excludes |
3 | Expression excl[i] cannot be parameterized, because it has dependencies to/from statements that will be extracted |