Convert the input string to an int value.

@param input
@param defaultValue
- if malformed, then return this instead
@return int
510665
private int convertInt(String input, int defaultValue) {
        try {
            return Integer.parseInt(input.trim());
        } catch (NumberFormatException nfe) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
                Tr.event(tc, "Malformed input: " + input);
            }
            return defaultValue;
        }
    }
1266436
static Integer getInteger(Properties properties, String key, Integer defaultValue) {
		if (properties == null)
			return defaultValue;
		String value = properties.getProperty(key);
		if (value == null || value.isEmpty())
			return defaultValue;
		int intVal;
		try {
			intVal = Integer.parseInt(value);
		} catch (NumberFormatException e) {
			logger.warn("Cannot read property '" + key + "'. Expected integer, but got '" + value + "'. Setting default value = '" + defaultValue + "'", e.getMessage());
			return defaultValue;
		}
		logger.trace("Read property '" + key + "' value '" + intVal + "'");
		return intVal;
	}
816882
private Integer parseIntegerFromParam(final String value, final int defaultValue) {
        try {
            return Integer.valueOf(value);
        } catch (NumberFormatException | NullPointerException e) {
            return defaultValue;
        }
    }
736921
public int getProperty(String key, int defaultValue) {
        String value = getProperty(key, String.class);
        return StringUtils.isEmpty(value) ? defaultValue : Integer.parseInt(value);
    }
750116
public int getInt(String key, int defaultValue) {
    	String value = get(key);
    	if(value == null) return defaultValue;
    	try {
    		return Integer.parseInt(value);
        } catch (NumberFormatException e) {
            throw new IllegalArgumentException(key + " parameter should be a number");
        }
    }
1104279
public static Integer toInteger(final StringValue stringValue)
	{
		Integer value = null;
		if (isNotNullOrEmpty(stringValue))
		{
			try
			{
				value = stringValue.toInteger();
			}
			catch (final StringValueConversionException e)
			{
				LOGGER.error("Error by converting the given StringValue.", e);
			}
		}
		return value;
	}
98502
public int getInteger(String name, int defaultValue) {
        try {
            String value = getString(name, null);
            if (!StringUtils.isNullOrEmpty(value)) {
                return Integer.parseInt(value.trim());
            }
        } catch (NumberFormatException e) {
            log.warn("Failed to parse integer for " + name + USING_DEFAULT_OF
                + defaultValue);
        }

        return defaultValue;
    }
277091
public static int getInt(Properties config, String key, int defaultValue) {
		String val = config.getProperty(key);
		if (val == null) {
			return defaultValue;
		} else {
			try {
				return Integer.parseInt(val);
			} catch (NumberFormatException nfe) {
				throw new IllegalArgumentException("Value for configuration key='" + key + "' is not set correctly. " +
						"Entered value='" + val + "'. Default value='" + defaultValue + "'");
			}
		}
	}
507427
public static Number toNumber(String str, Number defaultValue) {
	try {
	    // float
	    if (str.indexOf('.') != -1) {
		return new BigDecimal(str);
	    }
	    // integer
	    BigInteger bi = new BigInteger(str);
	    int l = bi.bitLength();
	    if (l < 32) return new Integer(bi.intValue());
	    if (l < 64) return new Long(bi.longValue());
	    return bi;
	}
	catch (Throwable t) {
	    ExceptionUtil.rethrowIfNecessary(t);
	    return defaultValue;
	}
    }
1373358
public Integer getInt(String key, Integer defaultValue) throws SyntaxException
    {
        String value = getSimple(key);
        return toInt(key, value, defaultValue);
    }
572995
public static Integer getInteger(String name, Integer defaultValue) {
		return Integer.getInteger(name, defaultValue);
	}
1253756
public int getInt(String key, int default_) {
    Object o = get(key);
    return o instanceof Number ? ((Number) o).intValue() : default_;
  }
643843
public int getInt(String name, int defaultVal){
        if(this.configuration.containsKey(name)){
            return this.configuration.getInt(name);
        } else {
            return defaultVal;
        }
    }
832473
public final void defaultValue() throws RecognitionException {
		int defaultValue_StartIndex = input.index();

		try {
			if ( state.backtracking>0 && alreadyParsedRule(input, 79) ) { return; }

			// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:677:6: ( 'default' elementValue )
			// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:677:8: 'default' elementValue
			{
			match(input,74,FOLLOW_74_in_defaultValue2721); if (state.failed) return;
			pushFollow(FOLLOW_elementValue_in_defaultValue2723);
			elementValue();
			state._fsp--;
			if (state.failed) return;
			}

		}
		catch (RecognitionException re) {
			reportError(re);
			recover(input,re);
		}
		finally {
			// do for sure before leaving
			if ( state.backtracking>0 ) { memoize(input, 79, defaultValue_StartIndex); }

		}
	}
1124291
public Integer getInt(String key, String group, Integer defaultValue) {
		return Convert.toInt(getByGroup(key, group), defaultValue);
	}
127835
public int getInt(String pName, int defaultValue) {
        String pValue = _properties.getProperty(pName);
        return parseInt(pName, pValue, defaultValue);
    }
1122134
public static Double toDoubleObject(@Nullable String str, Double defaultValue) {
		if (StringUtils.isEmpty(str)) {
			return defaultValue;
		}
		try {
			return Double.valueOf(str);
		} catch (final NumberFormatException nfe) {
			return defaultValue;
		}
	}