if (dbDefaultValue != null) { // try to use the DB default value StringBuffer mbuf = new StringBuffer(); Object newObject = validateAndConvert(dbDefaultValue, null, mbuf); // if there was a problem with converting, then just fall through // and continue as if there was no default given in the DB. // Otherwise, use the converted object if (mbuf.length() == 0) return newObject; } // no default in DB. If nullable, use null. if (_isNullable) return null; // field is not nullable, so create a reasonable default value return Short.valueOf((short)0);
if (dbDefaultValue != null) { // try to use the DB default value StringBuffer mbuf = new StringBuffer(); Object newObject = validateAndConvert(dbDefaultValue, null, mbuf); // if there was a problem with converting, then just fall through // and continue as if there was no default given in the DB. // Otherwise, use the converted object if (mbuf.length() == 0) return newObject; } // no default in DB. If nullable, use null. if (_isNullable) return null; // field is not nullable, so create a reasonable default value return new Time(new java.util.Date().getTime());
Clone fragments detected by clone detection tool
File path: /sql12/fw/src/net/sourceforge/squirrel_sql/fw/datasetviewer/cellcomponent/DataTypeShort.java File path: /sql12/fw/src/net/sourceforge/squirrel_sql/fw/datasetviewer/cellcomponent/DataTypeTime.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
			// try to use the DB default value
2
         // try to use the DB default value
3
			StringBuffer mbuf = new StringBuffer();
3
         StringBuffer mbuf = new StringBuffer();
4
			Object newObject = validateAndConvert(dbDefaultValue, null, mbuf);
4
         Object newObject = validateAndConvert(dbDefaultValue, null, mbuf);
5
			
6
			
7
// if there was a problem with converting, then just fall through
5
         // if there was a problem with converting, then just fall through
8
			// and continue as if there was no default given in the DB.
6
         // and continue as if there was no default given in the DB.
9
			// Otherwise, use the converted object
7
         // Otherwise, use the converted object
10
			if (mbuf.length() == 0)
8
         if (mbuf.length() == 0)
11
				return newObject;
9
            return newObject;
12
		}
13
		
14
		
10
      }
15
// no default in DB.  If nullable, use null.
11
      // no default in DB.  If nullable, use null.
16
		if (_isNullable)
12
      if (_isNullable)
17
			return null;
13
         return null;
18
		
19
		
20
// field is not nullable, so create a reasonable default value
14
      // field is not nullable, so create a reasonable default value
21
		return Short.valueOf((short)0);
15
      return new Time(new java.util.Date().getTime());
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.2
Clones locationClones are in different classes having the same super class
Number of node comparisons18
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements7
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)1.7
    Clone typeType 2
    Mapped Statements
    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 new Time(new java.util.Date().getTime());
    Preondition Violations
    Unmatched return new Time(new java.util.Date().getTime());
    8
    return new Time(new java.util.Date().getTime());
    8
    return Short.valueOf((short)0);
    8
    return Short.valueOf((short)0);
    Preondition Violations
    Unmatched return Short.valueOf((short)0);
                                                                        
    Precondition Violations (3)
    Row Violation
    1Unmatched return new Time(new java.util.Date().getTime());
    2Unmatched return Short.valueOf((short)0);
    3Not all possible execution flows end in a return statement