File path: /sql12/fw/src/net/sourceforge/squirrel_sql/fw/datasetviewer/cellcomponent/DataTypeBoolean.java | File path: /sql12/plugins/derby/src/net/sourceforge/squirrel_sql/plugins/derby/types/DerbyClobDataTypeComponent.java | |||
Method name: Object getDefaultValue(String)
|
Method name: Object getDefaultValue(String)
|
|||
Number of AST nodes: 8 | Number of AST nodes: 8 | |||
1 | if (dbDefaultValue != null)↵ | 1 | if (dbDefaultValue != null)↵ | |
2 | {↵ | |||
3 | ↵ | 2 | {↵ | |
4 | // try to use the DB default value↵ | 3 | // try to use the DB default value↵ | |
5 | StringBuffer mbuf = new StringBuffer();↵ | 4 | StringBuffer mbuf = new StringBuffer();↵ | |
6 | Object newObject = validateAndConvert(dbDefaultValue, null, mbuf);↵ | 5 | Object newObject = validateAndConvert(dbDefaultValue, null, mbuf);↵ | |
7 | // if there was a problem with converting, then just fall through↵ | 6 | // if there was a problem with converting, then just fall through↵ | |
8 | // and continue as if there was no default given in the DB.↵ | 7 | // and continue as if there was no default given in the DB.↵ | |
9 | // Otherwise, use the converted object↵ | 8 | // Otherwise, use the converted object↵ | |
10 | if (mbuf.length() == 0)↵ | 9 | if (mbuf.length() == 0) {↵ | |
11 | return newObject;↵ | 10 | return newObject;↵ | |
12 | }↵ | |||
13 | ↵ | 11 | }↵ | |
12 | }↵ | |||
14 | // no default in DB. If nullable, use null.↵ | 13 | // no default in DB. If nullable, use null.↵ | |
15 | if (_isNullable) {↵ | 14 | if (_isNullable) {↵ | |
16 | return null; }↵ | 15 | return null;↵ | |
17 | ↵ | |||
16 | }↵ | |||
18 | // field is not nullable, so create a reasonable default value↵ | 17 | // field is not nullable, so create a reasonable default value↵ | |
19 | return Boolean.TRUE; | 18 | return null; | |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 1 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.2 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 18 |
Number of mapped statements | 8 |
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) | 1.8 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | if (dbDefaultValue != null) | 1 | if (dbDefaultValue != null) | |||||||||||
2 | StringBuffer mbuf = new StringBuffer(); | 2 | StringBuffer mbuf = new StringBuffer(); | |||||||||||
3 | Object newObject = validateAndConvert(dbDefaultValue, null, mbuf); | 3 | Object newObject = validateAndConvert(dbDefaultValue, null, mbuf); | |||||||||||
4 | if (mbuf.length() == 0) | 4 | if (mbuf.length() == 0) | |||||||||||
5 | return newObject; | 5 | return newObject; | |||||||||||
6 | if (_isNullable) | 6 | if (_isNullable) | |||||||||||
7 | return null; | 7 | return null; | |||||||||||
8 | return Boolean.TRUE; |
| 8 | return null; |
Row | Violation |
---|