Issue #1998 fixed NPE in PointDataPluginDao

StorageStatus was not being checked after operation


Former-commit-id: 401cd813f1 [formerly 82736d581767831f426a17b0ee9d264fdda7dd64]
Former-commit-id: 1e6ae5a98e
This commit is contained in:
Brian Clements 2014-01-09 14:02:52 -06:00
parent 0c5b0eaf69
commit 25765f2fb6
2 changed files with 14 additions and 6 deletions

View file

@ -20,7 +20,6 @@
package com.raytheon.uf.common.datastorage;
import com.raytheon.uf.common.datastorage.IDataStore.StoreOp;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
@ -36,6 +35,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec 30, 2008 chammack Initial creation
* Jan 09, 2014 1998 bclement added hasExceptions method, removed ISerializableObject
*
* </pre>
*
@ -43,7 +43,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* @version 1.0
*/
@DynamicSerialize
public class StorageStatus implements ISerializableObject {
public class StorageStatus {
private StorageException[] exceptions;
@ -104,4 +104,11 @@ public class StorageStatus implements ISerializableObject {
this.indexOfAppend = indexOfAppend;
}
/**
* @return true if exceptions field is populated
*/
public boolean hasExceptions() {
return exceptions != null && exceptions.length > 0;
}
}

View file

@ -75,6 +75,7 @@ import com.raytheon.uf.edex.database.plugin.PluginDao;
* Apr 29, 2013 1861 bkowal Refactor hdf5 filename generation during reads
* into its own method so modelsounding dao can
* override it.
* Jan 09, 2014 1998 bclement fixed NPE in persistToHDF5 when store failed
*
* </pre>
*
@ -196,7 +197,8 @@ public abstract class PointDataPluginDao<T extends PluginDataObject> extends
try {
StorageStatus ss = ds.store(StoreOp.APPEND);
if (ss.getOperationPerformed() == StoreOp.APPEND) {
if (!ss.hasExceptions()
&& ss.getOperationPerformed() == StoreOp.APPEND) {
// increment the indices
List<PointDataView> views = containerMap.get(container);
int idx = (int) ss.getIndexOfAppend()[0];
@ -211,9 +213,8 @@ public abstract class PointDataPluginDao<T extends PluginDataObject> extends
StorageStatus aggregatedStatus = new StorageStatus();
List<StorageException> se = new ArrayList<StorageException>();
for (StorageStatus ss : ssList) {
StorageException[] seArr = ss.getExceptions();
if (seArr != null) {
se.addAll(Arrays.asList(seArr));
if (ss.hasExceptions()) {
se.addAll(Arrays.asList(ss.getExceptions()));
}
}