private int getDecimalScaleOrPrecision ( Record record , Field field , String attributeName , int defaultValue , int minAllowed ) throws OnRecordErrorException { int finalValue = - 1 ; // Invalid value // Firstly try the field attribute String stringValue = field . getAttribute ( attributeName ) ; if ( ! StringUtils . isEmpty ( stringValue ) ) { finalValue = Integer . valueOf ( stringValue ) ; } // If it's invalid, then use the default value if ( finalValue < minAllowed ) { finalValue = defaultValue ; } // If even the default value is invalid, then send the record to error if ( finalValue < minAllowed ) { throw new OnRecordErrorException ( record , Errors . SCHEMA_GEN_0004 , finalValue , field ) ; } return finalValue ; }
Resolve parameters of decimal type .