mirror of
https://gitee.com/jmix/cuba.git
synced 2024-12-01 02:38:21 +08:00
PL-7428 StackOverflowError in ScheduledExecution.toString()
This commit is contained in:
parent
16ed3c736e
commit
fc373ee96f
@ -20,7 +20,9 @@ package com.haulmont.cuba.core.app.scheduling;
|
|||||||
import com.haulmont.cuba.core.entity.ScheduledTask;
|
import com.haulmont.cuba.core.entity.ScheduledTask;
|
||||||
import com.haulmont.cuba.core.entity.SchedulingType;
|
import com.haulmont.cuba.core.entity.SchedulingType;
|
||||||
import com.haulmont.cuba.core.global.TimeSource;
|
import com.haulmont.cuba.core.global.TimeSource;
|
||||||
|
import com.haulmont.cuba.testsupport.TestContainer;
|
||||||
import junit.framework.Assert;
|
import junit.framework.Assert;
|
||||||
|
import org.junit.ClassRule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
@ -36,6 +38,9 @@ public class SchedulingTest {
|
|||||||
|
|
||||||
private SimpleDateFormat simpleDateFormat;
|
private SimpleDateFormat simpleDateFormat;
|
||||||
|
|
||||||
|
@ClassRule
|
||||||
|
public static TestContainer cont = TestContainer.Common.INSTANCE;
|
||||||
|
|
||||||
public SchedulingTest() {
|
public SchedulingTest() {
|
||||||
simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
|
simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
|
||||||
simpleDateFormat.setTimeZone(TimeZone.getTimeZone("GMT-0"));
|
simpleDateFormat.setTimeZone(TimeZone.getTimeZone("GMT-0"));
|
||||||
|
@ -98,14 +98,4 @@ public class ScheduledExecution extends BaseUuidEntity {
|
|||||||
|
|
||||||
return (finishTime.getTime() - startTime.getTime()) / 1000;
|
return (finishTime.getTime() - startTime.getTime()) / 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "ScheduledExecution{" +
|
|
||||||
"task=" + task +
|
|
||||||
", host='" + server + '\'' +
|
|
||||||
", startTime=" + startTime +
|
|
||||||
(finishTime != null ? ", finishTime=" : "") +
|
|
||||||
'}';
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -17,12 +17,13 @@
|
|||||||
|
|
||||||
package com.haulmont.cuba.core.entity;
|
package com.haulmont.cuba.core.entity;
|
||||||
|
|
||||||
|
import com.google.common.base.MoreObjects;
|
||||||
import com.haulmont.bali.util.Dom4j;
|
import com.haulmont.bali.util.Dom4j;
|
||||||
import com.haulmont.chile.core.annotations.MetaProperty;
|
import com.haulmont.chile.core.annotations.MetaProperty;
|
||||||
import com.haulmont.chile.core.annotations.NamePattern;
|
import com.haulmont.chile.core.annotations.NamePattern;
|
||||||
import com.haulmont.cuba.core.app.scheduled.MethodParameterInfo;
|
import com.haulmont.cuba.core.app.scheduled.MethodParameterInfo;
|
||||||
import com.haulmont.cuba.core.entity.annotation.SystemLevel;
|
import com.haulmont.cuba.core.entity.annotation.SystemLevel;
|
||||||
import org.apache.commons.lang.BooleanUtils;
|
import com.haulmont.cuba.core.global.PersistenceHelper;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.dom4j.Document;
|
import org.dom4j.Document;
|
||||||
import org.dom4j.DocumentHelper;
|
import org.dom4j.DocumentHelper;
|
||||||
@ -32,6 +33,7 @@ import javax.persistence.Column;
|
|||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
import javax.persistence.Transient;
|
import javax.persistence.Transient;
|
||||||
|
import java.text.DateFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@ -39,7 +41,6 @@ import java.util.List;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Entity that stores an information about a scheduled task.
|
* Entity that stores an information about a scheduled task.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@Entity(name = "sys$ScheduledTask")
|
@Entity(name = "sys$ScheduledTask")
|
||||||
@Table(name = "SYS_SCHEDULED_TASK")
|
@Table(name = "SYS_SCHEDULED_TASK")
|
||||||
@ -435,13 +436,21 @@ public class ScheduledTask extends BaseUuidEntity implements Creatable, Updatabl
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "ScheduledTask{" +
|
MoreObjects.ToStringHelper builder = MoreObjects.toStringHelper("ScheduledTask")
|
||||||
id + ", " +
|
.omitNullValues()
|
||||||
beanName + '.' + methodName +
|
.addValue(id);
|
||||||
(BooleanUtils.isTrue(singleton) ? ", singleton" : "") +
|
String[] fields = new String[]{"beanName", "methodName", "className", "scriptName", "singleton", "period", "cron", "startDate"};
|
||||||
", period=" + period +
|
for (String field : fields) {
|
||||||
(startDate != null ? ", startDate=" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(startDate) : "") +
|
if (PersistenceHelper.isLoaded(this, field)) {
|
||||||
'}';
|
Object value = getValue(field);
|
||||||
|
if (value instanceof Date) {
|
||||||
|
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
||||||
|
value = df.format(value);
|
||||||
|
}
|
||||||
|
builder.add(field, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@MetaProperty
|
@MetaProperty
|
||||||
|
Loading…
Reference in New Issue
Block a user