File path: /apache-ant-1.7.0/src/org/apache/tools/ant/Project.java | File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/CommandlineJava.java | |||
Method name: void setSystemProperties()
|
Method name: void setSystem()
|
|||
Number of AST nodes: 4 | Number of AST nodes: 3 | |||
1 | /** | 1 | /** | |
2 | * Add all system properties which aren't already defined as | 2 | * Cache the system properties and set the system properties to the | |
3 | * user properties to the project properties. | 3 | * new values. | |
4 | */ | 4 | * @throws BuildException if Security prevented this operation. | |
5 | public void setSystemProperties() { | 5 | */ | |
6 | Properties systemP = System.getProperties(); | 6 | public void setSystem() throws BuildException { | |
7 | Enumeration e = systemP.propertyNames(); | 7 | try { | |
8 | while (e.hasMoreElements()) { | 8 | sys = System.getProperties(); | |
9 | String propertyName = (String) e.nextElement(); | 9 | Properties p = new Properties(); | |
10 | String value = systemP.getProperty(propertyName); | 10 | for (Enumeration e = sys.propertyNames(); e.hasMoreElements();) { | |
11 | this.setPropertyInternal(propertyName, value); | 11 | String name = (String) e.nextElement(); | |
12 | } | 12 | p.put(name, sys.getProperty(name)); | |
13 | } | 13 | } | |
14 | p.putAll(mergePropertySets()); | |||
15 | for (Enumeration e = variables.elements(); e.hasMoreElements();) { | |||
16 | Environment.Variable v = (Environment.Variable) e.nextElement(); | |||
17 | v.validate(); | |||
18 | p.put(v.getKey(), v.getValue()); | |||
19 | } | |||
20 | System.setProperties(p); | |||
21 | } catch (SecurityException e) { | |||
22 | throw new BuildException("Cannot modify system properties", e); | |||
23 | } | |||
24 | } | |||
See real code fragment | See real code fragment |
Number of mapped statements | 5 |
Number of unmapped statements in the first code fragment | 2 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 0.0 |
Similarity Score | 0.600 |
Clone type | Type 3 |
ID | Statement | ID | Statement | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3 | while (e.hasMoreElements()) |
| 4 | for (Enumeration e = sys.propertyNames(); e.hasMoreElements(); ) | ||||||||||||||||
4 | String propertyName = (String)e.nextElement(); |
| 5 | String name = (String)e.nextElement(); | ||||||||||||||||
5 | String value = systemP.getProperty(propertyName); |
| | |||||||||||||||||
|
| 6 | p.put(name, sys.getProperty(name)); | |||||||||||||||||
6 | this.setPropertyInternal(propertyName, value); |
| |
Row | Violation |
---|---|
1 | Unmatched statement String value=systemP.getProperty(propertyName); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Unmatched statement p.put(name,sys.getProperty(name)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
3 | Unmatched statement this.setPropertyInternal(propertyName,value); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |