returns int value ,when format error occurred ,returns default value

@param defaultValue
@return
543239
public int toInt(int defaultValue) {
		try {
			return Integer.parseInt(sb.toString());
		} catch (java.lang.NumberFormatException e) {
			e.printStackTrace();
		}
		return defaultValue;
	}
612263
public int get(int key, int defaultValue) {
    int index = getKeyIndex(key);
    if (index >= 0) {
      return values[index];
    } else {
      return defaultValue;
    }
  }
1227017
public static Object getPrimitiveDefaultValue(Class<?> primitiveType) {
        if (boolean.class.equals(primitiveType)) {
            return false;
        } else if (byte.class.equals(primitiveType)) {
            return (byte) 0;
        } else if (char.class.equals(primitiveType)) {
            return '\0';
        } else if (short.class.equals(primitiveType)) {
            return (short) 0;
        } else if (int.class.equals(primitiveType)) {
            return 0;
        } else if (long.class.equals(primitiveType)) {
            return 0L;
        } else if (float.class.equals(primitiveType)) {
            return 0F;
        } else if (double.class.equals(primitiveType)) {
            return 0D;
        } else {
            return null;
        }
    }
768165
public static Integer toInteger(Object value, Integer defaultValue) {
        try {
            return toInteger(value);
        } catch (Exception e) {
            return defaultValue;
        }
    }
1357756
public float toFloat(float defaultValue) {
		try {
			return Float.parseFloat(sb.toString());
		} catch (java.lang.NumberFormatException e) {
		}
		return defaultValue;
	}
901033
public int get(Object key, int defaultValue) {
        if (key == null) { key = UniqueTag.NULL_VALUE; }
        int index = findIndex(key);
        if (0 <= index) {
            return values[index];
        }
        return defaultValue;
    }
656141
public Integer getDefaultOnNull(Integer value, Integer defaultValue)
   {
      return (value == null ? defaultValue : value);
   }
177273
public Double getParameterDouble(String name, Double defaultValue)
   {
      String value = getParameterValue(name, null);

      if (value != null)
      {
         try
         {
            return StringNumberParser.parseDouble(value);
         }
         catch (NumberFormatException e)
         {
            if (LOG.isTraceEnabled())
            {
               LOG.trace("An exception occurred: " + e.getMessage());
            }
         }
      }
      return defaultValue;
   }
1071004
public static int toIntWithDefault(String value, int defaultValue) {

        int result = defaultValue;
        try {
            result = Integer.parseInt(value);
        } catch (@SuppressWarnings("unused") Exception e) {
            // Do nothing, return default.
        }
        return result;
    }
916657
public Integer queryInt(String paramName, Integer defaultValue) {
        return this.request.queryInt(paramName, defaultValue);
    }
995585
private int getIntValue(int stackDepth, int defaultValue) {
        if (stack.getStackDepth() < stackDepth) {
            return defaultValue;
        }
        OpcodeStack.Item it = stack.getStackItem(stackDepth);
        Object value = it.getConstant();
        if (!(value instanceof Integer)) {
            return defaultValue;
        }
        return ((Number) value).intValue();
    }
781479
public static int getIntProperty(@Nonnull LogManager manager, @Nullable String name, int defaultValue) {
        if (name == null) {
            return defaultValue;
        }
        String val = manager.getProperty(name);
        if (val == null) {
            return defaultValue;
        }
        try {
            return Integer.parseInt(val.trim());
        } catch (Exception ex) {
            return defaultValue;
        }
    }
1014878
public String get(String key, String defaultValue) {
		addToDefaults(key, defaultValue);
		String value = get(key);
		if (value == null) {
			return defaultValue;
		} else {
			return value;
		}
	}
816882
private Integer parseIntegerFromParam(final String value, final int defaultValue) {
        try {
            return Integer.valueOf(value);
        } catch (NumberFormatException | NullPointerException e) {
            return defaultValue;
        }
    }
538698
public static int size(String size, int defaultValue) {
        int parseInt = NumUtils.intVal(size, defaultValue);
        return parseInt <= 0 ? defaultValue
                : (parseInt > DEFAULT_MAX_PAGE_SIZE ? DEFAULT_MAX_PAGE_SIZE : parseInt);
    }
741071
public static Integer hexToIntObject(@Nullable String str, Integer defaultValue) {
		if (StringUtils.isEmpty(str)) {
			return defaultValue;
		}
		try {
			return Integer.decode(str);
		} catch (final NumberFormatException nfe) {
			return defaultValue;
		}
	}
113775
public static int getInt(Properties props, String key, int defaultValue) {
    String value = props.getProperty(key);
    if (value != null) {
      return Integer.parseInt(value);
    } else {
      return defaultValue;
    }
  }