diff --git a/WebContent/WEB-INF/lib/jackson-datatype-jsr310-2.17.2.jar b/WebContent/WEB-INF/lib/jackson-datatype-jsr310-2.17.2.jar
new file mode 100644
index 000000000..3aa01f1ee
Binary files /dev/null and b/WebContent/WEB-INF/lib/jackson-datatype-jsr310-2.17.2.jar differ
diff --git a/WebContent/WEB-INF/springDispatcher-servlet.xml b/WebContent/WEB-INF/springDispatcher-servlet.xml
index 38bbea3af..d4ba5a5fc 100644
--- a/WebContent/WEB-INF/springDispatcher-servlet.xml
+++ b/WebContent/WEB-INF/springDispatcher-servlet.xml
@@ -232,6 +232,8 @@
+
+
diff --git a/src/com/serotonin/mango/web/dwr/BaseDwr.java b/src/com/serotonin/mango/web/dwr/BaseDwr.java
index 7522600a4..d001552f1 100644
--- a/src/com/serotonin/mango/web/dwr/BaseDwr.java
+++ b/src/com/serotonin/mango/web/dwr/BaseDwr.java
@@ -51,7 +51,7 @@
import org.scada_lts.mango.adapter.MangoEvent;
import org.scada_lts.mango.service.EventService;
import org.scada_lts.mango.service.SystemSettingsService;
-import org.scada_lts.web.contnet.SnippetContentGenerator;
+import org.scada_lts.web.content.SnippetContentGenerator;
abstract public class BaseDwr {
public static final String MODEL_ATTR_EVENTS = "events";
diff --git a/src/org/scada_lts/mango/service/DataPointService.java b/src/org/scada_lts/mango/service/DataPointService.java
index 0e44ceb8c..8ada7ca94 100644
--- a/src/org/scada_lts/mango/service/DataPointService.java
+++ b/src/org/scada_lts/mango/service/DataPointService.java
@@ -535,7 +535,7 @@ public void saveEventDetectors(DataPointVO dataPoint) {
for (PointEventDetectorVO pointEventDetector: dataPoint.getEventDetectors()) {
try {
pointEventDetectorDAO.insert(dataPoint.getId(), pointEventDetector);
- } catch (DuplicateKeyException e) {
+ } catch (Exception e) {
pointEventDetectorDAO.update(dataPoint.getId(), pointEventDetector);
}
}
diff --git a/src/org/scada_lts/mango/service/PointValueService.java b/src/org/scada_lts/mango/service/PointValueService.java
index 3286eea39..e51ab1152 100644
--- a/src/org/scada_lts/mango/service/PointValueService.java
+++ b/src/org/scada_lts/mango/service/PointValueService.java
@@ -545,11 +545,16 @@ static void add(BatchWriteBehindEntry e) {
}
}
}
+
+ private int instancesSize;
+ private int entriesSize;
+
public BatchWriteBehind() {}
@Override
public void work() {
try {
+ this.instancesSize = instances.size();
BatchWriteBehindEntry[] inserts;
while (true) {
synchronized (ENTRIES) {
@@ -558,6 +563,7 @@ public void work() {
inserts = new BatchWriteBehindEntry[ENTRIES.size() < MAX_ROWS ? ENTRIES
.size() : MAX_ROWS];
+ this.entriesSize = inserts.length;
ENTRIES.pop(inserts);
ENTRIES_MONITOR.setValue(ENTRIES.size());
}
@@ -617,7 +623,7 @@ public WorkItemPriority getPriorityType() {
@Override
public String toString() {
- return "BatchWriteBehind{instances size: " + instances.size() + '}';
+ return "BatchWriteBehind{current instances size: " + INSTANCES_MONITOR.getValue() + ", current entries size: " + ENTRIES_MONITOR.getValue() + ", instances size: " + this.instancesSize + ", entries size: " + this.entriesSize + '}';
}
@Override
diff --git a/src/org/scada_lts/mango/service/SystemSettingsService.java b/src/org/scada_lts/mango/service/SystemSettingsService.java
index 16031eb49..f089b91a2 100644
--- a/src/org/scada_lts/mango/service/SystemSettingsService.java
+++ b/src/org/scada_lts/mango/service/SystemSettingsService.java
@@ -8,6 +8,7 @@
import com.serotonin.mango.rt.event.type.AuditEventType;
import com.serotonin.mango.rt.event.type.SystemEventType;
import com.serotonin.mango.rt.maint.DataPurge;
+import com.serotonin.mango.util.LoggingUtils;
import com.serotonin.mango.vo.User;
import com.serotonin.mango.vo.bean.PointHistoryCount;
import com.serotonin.mango.vo.event.EventTypeVO;
@@ -525,8 +526,14 @@ private static Map deserializeMap(String json) {
}
public CssStyle getCustomCss() {
- String content = SystemSettingsDAO.getValue(SystemSettingsDAO.CUSTOM_CSS_CONTENT);
- return new CssStyle(content);
+ String defaultContent = SystemSettingsUtils.getCustomCssContent();
+ try {
+ String content = SystemSettingsDAO.getValue(SystemSettingsDAO.CUSTOM_CSS_CONTENT);
+ return new CssStyle(content);
+ } catch (Exception ex) {
+ LOG.error(LoggingUtils.exceptionInfo(ex));
+ return new CssStyle(defaultContent);
+ }
}
public void saveCustomCss(CssStyle cssStyle) {
diff --git a/src/org/scada_lts/web/beans/serializer/ChronologySerializer.java b/src/org/scada_lts/web/beans/serializer/ChronologySerializer.java
new file mode 100644
index 000000000..515ad7203
--- /dev/null
+++ b/src/org/scada_lts/web/beans/serializer/ChronologySerializer.java
@@ -0,0 +1,24 @@
+package org.scada_lts.web.beans.serializer;
+
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.databind.SerializerProvider;
+import com.fasterxml.jackson.databind.ser.std.StdSerializer;
+
+import java.io.IOException;
+import java.time.chrono.Chronology;
+
+
+public class ChronologySerializer extends StdSerializer {
+
+ public ChronologySerializer() {
+ super(Chronology.class);
+ }
+
+ @Override
+ public void serialize(Chronology value, JsonGenerator jgen, SerializerProvider provider) throws IOException {
+ jgen.writeStartObject();
+ jgen.writeStringField("id", value.getId());
+ jgen.writeStringField("calendarType", value.getCalendarType());
+ jgen.writeEndObject();
+ }
+}
\ No newline at end of file
diff --git a/src/org/scada_lts/web/beans/serializer/LocalDateTimeSerializer.java b/src/org/scada_lts/web/beans/serializer/LocalDateTimeSerializer.java
new file mode 100644
index 000000000..8577f1d09
--- /dev/null
+++ b/src/org/scada_lts/web/beans/serializer/LocalDateTimeSerializer.java
@@ -0,0 +1,33 @@
+package org.scada_lts.web.beans.serializer;
+
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.databind.SerializerProvider;
+import com.fasterxml.jackson.databind.ser.std.StdSerializer;
+
+import java.io.IOException;
+import java.time.LocalDateTime;
+
+
+public class LocalDateTimeSerializer extends StdSerializer {
+
+ public LocalDateTimeSerializer() {
+ super(LocalDateTime.class);
+ }
+
+ @Override
+ public void serialize(LocalDateTime value, JsonGenerator jgen, SerializerProvider provider) throws IOException {
+ jgen.writeStartObject();
+ jgen.writeNumberField("nano", value.getNano());
+ jgen.writeNumberField("year", value.getYear());
+ jgen.writeNumberField("monthValue", value.getMonthValue());
+ jgen.writeNumberField("dayOfMonth", value.getDayOfMonth());
+ jgen.writeNumberField("hour", value.getHour());
+ jgen.writeNumberField("minute", value.getMinute());
+ jgen.writeNumberField("second", value.getSecond());
+ jgen.writeStringField("month", value.getMonth().name());
+ jgen.writeStringField("dayOfWeek", value.getDayOfWeek().name());
+ jgen.writeNumberField("dayOfYear", value.getDayOfYear());
+ jgen.writeObjectField("chronology", value.getChronology());
+ jgen.writeEndObject();
+ }
+}
\ No newline at end of file
diff --git a/src/org/scada_lts/web/contnet/SnippetContentGenerator.java b/src/org/scada_lts/web/content/SnippetContentGenerator.java
similarity index 99%
rename from src/org/scada_lts/web/contnet/SnippetContentGenerator.java
rename to src/org/scada_lts/web/content/SnippetContentGenerator.java
index b87a887af..950ba6a09 100644
--- a/src/org/scada_lts/web/contnet/SnippetContentGenerator.java
+++ b/src/org/scada_lts/web/content/SnippetContentGenerator.java
@@ -1,4 +1,4 @@
-package org.scada_lts.web.contnet;
+package org.scada_lts.web.content;
import java.io.IOException;
import java.util.HashMap;
diff --git a/src/org/scada_lts/web/contnet/SnippetServletResponse.java b/src/org/scada_lts/web/content/SnippetServletResponse.java
similarity index 99%
rename from src/org/scada_lts/web/contnet/SnippetServletResponse.java
rename to src/org/scada_lts/web/content/SnippetServletResponse.java
index 24bd961df..d28d858c7 100644
--- a/src/org/scada_lts/web/contnet/SnippetServletResponse.java
+++ b/src/org/scada_lts/web/content/SnippetServletResponse.java
@@ -1,4 +1,4 @@
-package org.scada_lts.web.contnet;
+package org.scada_lts.web.content;
import java.io.IOException;
import java.io.PrintWriter;
diff --git a/test/com/serotonin/mango/web/dwr/MiscDwrDoLongPollAlarmsMultiThreadTest.java b/test/com/serotonin/mango/web/dwr/MiscDwrDoLongPollAlarmsMultiThreadTest.java
index 7f67d3a56..09708facd 100644
--- a/test/com/serotonin/mango/web/dwr/MiscDwrDoLongPollAlarmsMultiThreadTest.java
+++ b/test/com/serotonin/mango/web/dwr/MiscDwrDoLongPollAlarmsMultiThreadTest.java
@@ -15,7 +15,7 @@
import org.powermock.modules.junit4.PowerMockRunner;
import org.scada_lts.dao.SystemSettingsDAO;
import org.scada_lts.mango.service.EventService;
-import org.scada_lts.web.contnet.SnippetContentGenerator;
+import org.scada_lts.web.content.SnippetContentGenerator;
import org.springframework.mock.web.MockHttpSession;
import utils.TestConcurrentUtils;
import utils.mock.EventServiceMock;
diff --git a/test/com/serotonin/mango/web/dwr/MiscDwrDoLongPollMultiThreadTest.java b/test/com/serotonin/mango/web/dwr/MiscDwrDoLongPollMultiThreadTest.java
index 633e9af0b..10d7d860b 100644
--- a/test/com/serotonin/mango/web/dwr/MiscDwrDoLongPollMultiThreadTest.java
+++ b/test/com/serotonin/mango/web/dwr/MiscDwrDoLongPollMultiThreadTest.java
@@ -30,7 +30,7 @@
import org.scada_lts.dao.SystemSettingsDAO;
import org.scada_lts.mango.service.EventService;
import org.scada_lts.mango.service.ViewService;
-import org.scada_lts.web.contnet.SnippetContentGenerator;
+import org.scada_lts.web.content.SnippetContentGenerator;
import org.springframework.mock.web.MockHttpSession;
import utils.*;
import utils.mock.ChangePointValueDataPointRtMock;