Search in sources :

Example 16 with SonarException

use of org.sonar.api.utils.SonarException in project sonarqube by SonarSource.

the class ProjectAnalysisInfo method loadAnalysisDate.

private Date loadAnalysisDate() {
    Date date;
    try {
        // sonar.projectDate may have been specified as a time
        date = settings.getDateTime(CoreProperties.PROJECT_DATE_PROPERTY);
    } catch (SonarException e) {
        // this is probably just a date
        date = settings.getDate(CoreProperties.PROJECT_DATE_PROPERTY);
    }
    if (date == null) {
        date = new Date(system2.now());
        settings.setProperty(CoreProperties.PROJECT_DATE_PROPERTY, date, true);
    }
    return date;
}
Also used : SonarException(org.sonar.api.utils.SonarException) Date(java.util.Date)

Aggregations

SonarException (org.sonar.api.utils.SonarException)16 Test (org.junit.Test)6 IOException (java.io.IOException)4 URI (java.net.URI)4 SMInputCursor (org.codehaus.staxmate.in.SMInputCursor)3 Release (org.sonar.updatecenter.common.Release)3 File (java.io.File)2 URISyntaxException (java.net.URISyntaxException)2 MapSettings (org.sonar.api.config.MapSettings)2 Plugin (org.sonar.updatecenter.common.Plugin)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 ObjectOutputStream (java.io.ObjectOutputStream)1 InetSocketAddress (java.net.InetSocketAddress)1 NoRouteToHostException (java.net.NoRouteToHostException)1 SocketException (java.net.SocketException)1 SocketTimeoutException (java.net.SocketTimeoutException)1 SQLException (java.sql.SQLException)1 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 XMLInputFactory (javax.xml.stream.XMLInputFactory)1