Merge "Issue #1998 fixed NPE in PointDataPluginDao" into development

Former-commit-id: a04a5427256f18725d85da15497d9637419c885c
This commit is contained in:
Nate Jensen 2014-01-10 08:58:03 -06:00 committed by Gerrit Code Review
commit 32909203d0
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()));
}
}