We wanted to be able to detect when a PV had become disconnected so that we could show it in the CS-Studio data browser. We followed the advice discussed in the issue https://github.com/slacmshankar/epicsarchiverap/issues/96 to get the fields 'cnxlostepsecs' from the extra fields in the RAW response or if using the Optimized or OptimizedWithLastSample postprocessors the 'connectionChange' field added by the AA.
However we found a special case where the information on a disconnect is completely lost. If the user requests Optimized or OptimizedWithLastSample data but the number of bins is larger than the number of events in a time period, then the raw events get transformed into a POJOEvent and returned. This type of event has no capacity to hold the extra fields information and so loses any information on the disconnect.
This PR contains a fix for this by retaining the original event fields instead of creating a new POJOEvent.
The PR also contains a minor bug fix in the OptimizedWithLastSample.java code to check 2 objects are not null before using them (bug found will testing the above).
We wanted to be able to detect when a PV had become disconnected so that we could show it in the CS-Studio data browser. We followed the advice discussed in the issue https://github.com/slacmshankar/epicsarchiverap/issues/96 to get the fields '
cnxlostepsecs
' from the extra fields in the RAW response or if using theOptimized
orOptimizedWithLastSample
postprocessors the 'connectionChange
' field added by the AA.However we found a special case where the information on a disconnect is completely lost. If the user requests
Optimized
orOptimizedWithLastSample
data but the number of bins is larger than the number of events in a time period, then the raw events get transformed into aPOJOEvent
and returned. This type of event has no capacity to hold the extra fields information and so loses any information on the disconnect.This PR contains a fix for this by retaining the original event fields instead of creating a new
POJOEvent
.The PR also contains a minor bug fix in the
OptimizedWithLastSample.java
code to check 2 objects are not null before using them (bug found will testing the above).