Search in sources :

Example 6 with InternalErrorRuntimeException

use of cz.metacentrum.perun.core.api.exceptions.rt.InternalErrorRuntimeException in project perun by CESNET.

the class Auditable method compareByModifiedAt.

public int compareByModifiedAt(Auditable auditable) {
    if (auditable == null || auditable.modifiedAt == null || this.modifiedAt == null) {
        throw new InternalErrorRuntimeException(new NullPointerException("There is null pointer in auditable object or in createdAt"));
    }
    Date date1;
    try {
        date1 = BeansUtils.getDateFormatter().parse(modifiedAt);
    } catch (Exception ex) {
        throw new InternalErrorRuntimeException("There is problem with parsing createdAt in object " + this, ex);
    }
    Date date2;
    try {
        date2 = BeansUtils.getDateFormatter().parse(auditable.getModifiedAt());
    } catch (Exception ex) {
        throw new InternalErrorRuntimeException("There is problem with parsing createdAt in object " + auditable, ex);
    }
    return date1.compareTo(date2);
}
Also used : InternalErrorRuntimeException(cz.metacentrum.perun.core.api.exceptions.rt.InternalErrorRuntimeException) Date(java.util.Date) InternalErrorRuntimeException(cz.metacentrum.perun.core.api.exceptions.rt.InternalErrorRuntimeException) ParseException(java.text.ParseException)

Aggregations

InternalErrorRuntimeException (cz.metacentrum.perun.core.api.exceptions.rt.InternalErrorRuntimeException)6 InternalErrorException (cz.metacentrum.perun.core.api.exceptions.InternalErrorException)4 SQLException (java.sql.SQLException)3 HashMap (java.util.HashMap)3 ExtSource (cz.metacentrum.perun.core.api.ExtSource)2 ExtSourceExistsException (cz.metacentrum.perun.core.api.exceptions.ExtSourceExistsException)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 IOException (java.io.IOException)2 InputStream (java.io.InputStream)2 PreparedStatement (java.sql.PreparedStatement)2 ResultSet (java.sql.ResultSet)2 ParseException (java.text.ParseException)2 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2 Map (java.util.Map)2 ExtSourceAlreadyAssignedException (cz.metacentrum.perun.core.api.exceptions.ExtSourceAlreadyAssignedException)1 ExtSourceAlreadyRemovedException (cz.metacentrum.perun.core.api.exceptions.ExtSourceAlreadyRemovedException)1 ExtSourceNotAssignedException (cz.metacentrum.perun.core.api.exceptions.ExtSourceNotAssignedException)1 ExtSourceNotExistsException (cz.metacentrum.perun.core.api.exceptions.ExtSourceNotExistsException)1 BufferedInputStream (java.io.BufferedInputStream)1