mirror of
https://github.com/PAMGuard/PAMGuard.git
synced 2024-11-21 22:52:22 +00:00
Map key exception
Fix bug in map key that was getting null pointers.
This commit is contained in:
parent
6db451699f
commit
3e71a0f3d9
@ -1456,13 +1456,13 @@ public class PamController implements PamControllerInterface, PamSettings {
|
||||
for (int iU = 0; iU < pamControlledUnits.size(); iU++) {
|
||||
pamControlledUnits.get(iU).pamHasStopped();
|
||||
}
|
||||
guiFrameManager.pamEnded();
|
||||
|
||||
long stopTime = PamCalendar.getTimeInMillis();
|
||||
saveEndSettings(stopTime);
|
||||
|
||||
setPamStatus(PAM_IDLE);
|
||||
|
||||
guiFrameManager.pamEnded();
|
||||
|
||||
// no good having this here since it get's called at the end of every file.
|
||||
// if (GlobalArguments.getParam(PamController.AUTOEXIT) != null) {
|
||||
//// can exit here, since we've auto started, can auto exit.
|
||||
|
@ -36,7 +36,7 @@ public class PamguardVersionInfo {
|
||||
/**
|
||||
* Release date
|
||||
*/
|
||||
static public final String date = "23 April 2024";
|
||||
static public final String date = "1 May 2024";
|
||||
|
||||
// /**
|
||||
// * Release type - Beta or Core
|
||||
|
@ -58,17 +58,23 @@ public class JPanelWithPamKey extends PamPanel implements ColorManaged {
|
||||
}
|
||||
|
||||
private void replaceKeyPanel(KeyPanel newPanel) {
|
||||
if (keyPanel != null) {
|
||||
// synchronized (keyPanel) {
|
||||
try {
|
||||
if (keyPanel != null) {
|
||||
// synchronized (keyPanel) {
|
||||
remove(keyPanel.getPanel());
|
||||
// }
|
||||
// }
|
||||
}
|
||||
if (newPanel != null) {
|
||||
// synchronized (newPanel) {
|
||||
add(newPanel.getPanel(), gc);
|
||||
// }
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
||||
}
|
||||
keyPanel = newPanel;
|
||||
if (keyPanel != null) {
|
||||
// synchronized (newPanel) {
|
||||
add(keyPanel.getPanel(), gc);
|
||||
// }
|
||||
}
|
||||
|
||||
this.invalidate();
|
||||
this.repaint(10);
|
||||
drawKeyOnTop();
|
||||
|
@ -4,9 +4,11 @@ import java.util.ArrayList;
|
||||
|
||||
import PamController.DataIntegrityChecker;
|
||||
import PamController.PamController;
|
||||
import PamUtils.PamCalendar;
|
||||
import PamView.dialog.warn.WarnOnce;
|
||||
import PamguardMVC.PamDataBlock;
|
||||
import binaryFileStorage.BinaryStore;
|
||||
import dataMap.MapOverlap;
|
||||
import dataMap.OfflineDataMap;
|
||||
|
||||
public class BinaryIntegrityChecker implements DataIntegrityChecker {
|
||||
@ -38,16 +40,16 @@ public class BinaryIntegrityChecker implements DataIntegrityChecker {
|
||||
if (dataMap == null) {
|
||||
return true;
|
||||
}
|
||||
long overlaps = dataMap.checkOverlaps();
|
||||
if (overlaps <= 0) {
|
||||
ArrayList<MapOverlap> overlaps = dataMap.checkOverlaps();
|
||||
if (overlaps == null || overlaps.size() == 0) {
|
||||
return true;
|
||||
}
|
||||
String warn = String.format("<html>Binary data %s has overlapping data files, with a maximum overlap of %3.1fs<br>"
|
||||
String warn = String.format("<html>Binary data %s has %d overlapping data files, the first one at %s to %s<br>"
|
||||
+ "This can occur when data have been reprocessed multiple times offline into "
|
||||
+ "the same folders.<br>Since files sometimes get slightly different names, old files are"
|
||||
+ "not always overwritten. <br>"
|
||||
+ "You should determine which files are 'old' by looking at file creation dates and delete them.",
|
||||
aBlock.getLongDataName(), (double) overlaps / 1000.);
|
||||
aBlock.getLongDataName(), overlaps.size(), PamCalendar.formatDBDateTime(overlaps.get(0).getFile1End()), PamCalendar.formatDBDateTime(overlaps.get(0).getFile2Start()));
|
||||
WarnOnce.showNamedWarning("BINOVERLAPWARNING", PamController.getMainFrame(), "Data Integrity Warning", warn, WarnOnce.WARNING_MESSAGE);
|
||||
return false;
|
||||
}
|
||||
|
30
src/dataMap/MapOverlap.java
Normal file
30
src/dataMap/MapOverlap.java
Normal file
@ -0,0 +1,30 @@
|
||||
package dataMap;
|
||||
|
||||
public class MapOverlap {
|
||||
|
||||
private long file2Start;
|
||||
|
||||
private long file1End;
|
||||
|
||||
public MapOverlap(long file1End, long file2Start) {
|
||||
super();
|
||||
this.file1End = file1End;
|
||||
this.file2Start = file2Start;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the file2Start
|
||||
*/
|
||||
public long getFile2Start() {
|
||||
return file2Start;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the file1End
|
||||
*/
|
||||
public long getFile1End() {
|
||||
return file1End;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -847,20 +847,22 @@ abstract public class OfflineDataMap<TmapPoint extends OfflineDataMapPoint> {
|
||||
|
||||
/**
|
||||
* Check to see if any data maps overlap in time.
|
||||
* @return largest overlap between maps. 0 or -ve means no overlap.
|
||||
* @return list of overlaps.
|
||||
*/
|
||||
public long checkOverlaps() {
|
||||
public ArrayList<MapOverlap> checkOverlaps() {
|
||||
long bigLap = Long.MIN_VALUE;
|
||||
TmapPoint prevPoint = null;
|
||||
ArrayList<MapOverlap> overlaps = new ArrayList<>();
|
||||
for (TmapPoint mapPoint : mapPoints) {
|
||||
if (prevPoint != null) {
|
||||
long olap = prevPoint.getEndTime() - mapPoint.getStartTime();
|
||||
// if (mapPoint.getStartTime() < prevPoint.getEndTime()) {
|
||||
if (mapPoint.getStartTime() < prevPoint.getEndTime()) {
|
||||
bigLap = Math.max(olap, bigLap);
|
||||
// }
|
||||
overlaps.add(new MapOverlap(prevPoint.getEndTime(), mapPoint.getStartTime()));
|
||||
}
|
||||
}
|
||||
prevPoint = mapPoint;
|
||||
}
|
||||
return bigLap;
|
||||
return overlaps;
|
||||
}
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ public class PamFFTProcess extends PamProcess {
|
||||
|
||||
public synchronized void setupFFT() {
|
||||
|
||||
System.out.println("In call to setupFFT in " + getProcessName());
|
||||
// System.out.println("In call to setupFFT in " + getProcessName());
|
||||
// need to find the existing source data block and remove from observing it.
|
||||
// then find the new one and subscribe to that instead.
|
||||
channelCounts = new int[PamConstants.MAX_CHANNELS];
|
||||
|
@ -197,15 +197,15 @@ public class DBXMLConnect {
|
||||
marshal.marshal(nilusObject, tempFile.toString());
|
||||
// above lines have made a file. Are now going to gzip it before sending to Tethys
|
||||
File zipFile = null;
|
||||
try {
|
||||
zipFile = zipOutputFile(tempFile);
|
||||
}
|
||||
catch (FileNotFoundException e1){
|
||||
System.out.println(e1.getMessage());
|
||||
}
|
||||
catch (IOException e2) {
|
||||
System.out.println(e2.getMessage());
|
||||
}
|
||||
// try {
|
||||
// zipFile = zipOutputFile(tempFile);
|
||||
// }
|
||||
// catch (FileNotFoundException e1){
|
||||
// System.out.println(e1.getMessage());
|
||||
// }
|
||||
// catch (IOException e2) {
|
||||
// System.out.println(e2.getMessage());
|
||||
// }
|
||||
String finalName;
|
||||
if (zipFile == null) {
|
||||
finalName = bodgeName;
|
||||
|
Loading…
Reference in New Issue
Block a user