Search in sources :

Example 1 with ZapApiIgnore

use of org.zaproxy.zap.extension.api.ZapApiIgnore in project zaproxy by zaproxy.

the class OptionsParamCheckForUpdates method checkOnStart.

/**
	 * Tells whether or not a "check for updates on start up" needs to be performed.
	 * <p>
	 * A check for updates needs to be performed if the method {@code isCheckOnStart()} returns {@code true} and if no check was
	 * already done during the same day.
	 * </p>
	 * 
	 * @return {@code true} if a check for updates on start up needs to be performed, {@code false} otherwise.
	 * @see #isCheckOnStart()
	 */
@ZapApiIgnore
public boolean checkOnStart() {
    if (!checkOnStart) {
        log.debug("isCheckForStart - false");
        return false;
    }
    String today = getSdf().format(new Date());
    if (today.equals(dayLastChecked)) {
        log.debug("isCheckForStart - already checked today");
        return false;
    }
    getConfig().setProperty(DAY_LAST_CHECKED, today);
    try {
        getConfig().save();
    } catch (ConfigurationException e) {
        log.error(e.getMessage(), e);
    }
    return true;
}
Also used : ConfigurationException(org.apache.commons.configuration.ConfigurationException) Date(java.util.Date) ZapApiIgnore(org.zaproxy.zap.extension.api.ZapApiIgnore)

Aggregations

Date (java.util.Date)1 ConfigurationException (org.apache.commons.configuration.ConfigurationException)1 ZapApiIgnore (org.zaproxy.zap.extension.api.ZapApiIgnore)1