#889 ignore exception

This commit is contained in:
Shinsuke Sugaya 2017-02-09 17:33:31 +09:00
parent f4fc74617c
commit 97cecd7054
4 changed files with 48 additions and 12 deletions

View file

@ -19,20 +19,29 @@ import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import org.codelibs.fess.es.log.bsbhv.BsClickLogBhv;
import org.dbflute.util.DfTypeUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author FreeGen
*/
public class ClickLogBhv extends BsClickLogBhv {
private static final Logger logger = LoggerFactory.getLogger(ClickLogBhv.class);
@Override
protected LocalDateTime toLocalDateTime(Object value) {
if (value != null) {
Instant instant = Instant.from(DateTimeFormatter.ISO_INSTANT.parse(value.toString()));
LocalDateTime date = LocalDateTime.ofInstant(instant, ZoneId.systemDefault());
return date;
try {
Instant instant = Instant.from(DateTimeFormatter.ISO_INSTANT.parse(value.toString()));
LocalDateTime date = LocalDateTime.ofInstant(instant, ZoneId.systemDefault());
return date;
} catch (final DateTimeParseException e) {
logger.debug("Invalid date format: " + value, e);
}
}
return DfTypeUtil.toLocalDateTime(value);
}

View file

@ -19,20 +19,29 @@ import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import org.codelibs.fess.es.log.bsbhv.BsFavoriteLogBhv;
import org.dbflute.util.DfTypeUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author FreeGen
*/
public class FavoriteLogBhv extends BsFavoriteLogBhv {
private static final Logger logger = LoggerFactory.getLogger(FavoriteLogBhv.class);
@Override
protected LocalDateTime toLocalDateTime(Object value) {
if (value != null) {
Instant instant = Instant.from(DateTimeFormatter.ISO_INSTANT.parse(value.toString()));
LocalDateTime date = LocalDateTime.ofInstant(instant, ZoneId.systemDefault());
return date;
try {
Instant instant = Instant.from(DateTimeFormatter.ISO_INSTANT.parse(value.toString()));
LocalDateTime date = LocalDateTime.ofInstant(instant, ZoneId.systemDefault());
return date;
} catch (final DateTimeParseException e) {
logger.debug("Invalid date format: " + value, e);
}
}
return DfTypeUtil.toLocalDateTime(value);
}

View file

@ -19,20 +19,29 @@ import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import org.codelibs.fess.es.log.bsbhv.BsSearchLogBhv;
import org.dbflute.util.DfTypeUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author FreeGen
*/
public class SearchLogBhv extends BsSearchLogBhv {
private static final Logger logger = LoggerFactory.getLogger(SearchLogBhv.class);
@Override
protected LocalDateTime toLocalDateTime(Object value) {
if (value != null) {
Instant instant = Instant.from(DateTimeFormatter.ISO_INSTANT.parse(value.toString()));
LocalDateTime date = LocalDateTime.ofInstant(instant, ZoneId.systemDefault());
return date;
try {
Instant instant = Instant.from(DateTimeFormatter.ISO_INSTANT.parse(value.toString()));
LocalDateTime date = LocalDateTime.ofInstant(instant, ZoneId.systemDefault());
return date;
} catch (final DateTimeParseException e) {
logger.debug("Invalid date format: " + value, e);
}
}
return DfTypeUtil.toLocalDateTime(value);
}

View file

@ -19,21 +19,30 @@ import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import org.codelibs.fess.es.log.bsbhv.BsUserInfoBhv;
import org.dbflute.util.DfTypeUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author FreeGen
*/
public class UserInfoBhv extends BsUserInfoBhv {
private static final Logger logger = LoggerFactory.getLogger(UserInfoBhv.class);
@Override
protected LocalDateTime toLocalDateTime(Object value) {
if (value != null) {
Instant instant = Instant.from(DateTimeFormatter.ISO_INSTANT.parse(value.toString()));
LocalDateTime date = LocalDateTime.ofInstant(instant, ZoneId.systemDefault());
return date;
try {
Instant instant = Instant.from(DateTimeFormatter.ISO_INSTANT.parse(value.toString()));
LocalDateTime date = LocalDateTime.ofInstant(instant, ZoneId.systemDefault());
return date;
} catch (final DateTimeParseException e) {
logger.debug("Invalid date format: " + value, e);
}
}
return DfTypeUtil.toLocalDateTime(value);
}