File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/persister/entity/AbstractPropertyMapping.java | File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/persister/entity/AbstractPropertyMapping.java | |||
Method name: String[] toColumns(String, String)
|
Method name: String[] toColumns(String)
|
|||
Number of AST nodes: 10 | Number of AST nodes: 10 | |||
1 | String[] columns = (String[]) columnsByPropertyPath.get(propertyName);↵ | 1 | String[] columns = (String[]) columnsByPropertyPath.get(propertyName);↵ | |
2 | if ( columns == null ) {↵ | 2 | if ( columns == null ) {↵ | |
3 | throw propertyException( propertyName );↵ | 3 | throw propertyException( propertyName );↵ | |
4 | }↵ | 4 | }↵ | |
5 | String[] templates = (String[]) formulaTemplatesByPropertyPath.get(propertyName);↵ | 5 | String[] templates = (String[]) formulaTemplatesByPropertyPath.get(propertyName);↵ | |
6 | String[] result = new String[columns.length];↵ | 6 | String[] result = new String[columns.length];↵ | |
7 | for ( int i=0; i<columns.length; i++ ) {↵ | 7 | for ( int i=0; i<columns.length; i++ ) {↵ | |
8 | if ( columns[i]==null ) {↵ | 8 | if ( columns[i]==null ) {↵ | |
9 | result[i] = StringHelper.replace( templates[i], Template.TEMPLATE, alias );↵ | 9 | result[i] = StringHelper.replace( templates[i], Template.TEMPLATE, "" );↵ | |
10 | }↵ | 10 | }↵ | |
11 | else {↵ | 11 | else {↵ | |
12 | result[i] = StringHelper.qualify( alias, columns[i] );↵ | 12 | result[i] = columns[i];↵ | |
13 | }↵ | 13 | }↵ | |
14 | }↵ | 14 | }↵ | |
15 | return result; | 15 |
| |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.3 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 30 |
Number of mapped statements | 10 |
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) | 2.4 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | String[] columns = (String[])columnsByPropertyPath.get(propertyName); | 1 | String[] columns = (String[])columnsByPropertyPath.get(propertyName); | |||||||||||||
2 | if (columns == null) | 2 | if (columns == null) | |||||||||||||
3 | throw propertyException(propertyName); | 3 | throw propertyException(propertyName); | |||||||||||||
4 | String[] templates = (String[])formulaTemplatesByPropertyPath.get(propertyName); | 4 | String[] templates = (String[])formulaTemplatesByPropertyPath.get(propertyName); | |||||||||||||
5 | String[] result = new String[columns.length]; | 5 | String[] result = new String[columns.length]; | |||||||||||||
6 | for (int i = 0; i < columns.length; i++) | 6 | for (int i = 0; i < columns.length; i++) | |||||||||||||
7 | if (columns[i] == null) | 7 | if (columns[i] == null) | |||||||||||||
8 | result[i] = StringHelper.replace(templates[i], Template.TEMPLATE, alias); |
| 8 | result[i] = StringHelper.replace(templates[i], Template.TEMPLATE, ""); | ||||||||||||
else | else | |||||||||||||||
9 | result[i] = StringHelper.qualify(alias, columns[i]); |
| 9 | result[i] = columns[i]; | ||||||||||||
10 | return result; | 10 | return result; |
Row | Violation |
---|---|
1 | Expression StringHelper.qualify(alias,columns[i]) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression columns[i] cannot be parameterized, because it has dependencies to/from statements that will be extracted |