Issue #2741 Fixed nullpointers in Retrieval and BWM
Change-Id: I2530b194fa7f1b4fb2a6af4211e82b29b9b0c576 Former-commit-id: 3c47b3cb0ee18e485082e8a53d43b38722c5dce4
This commit is contained in:
parent
5e8866a859
commit
2e1d02fe21
2 changed files with 24 additions and 15 deletions
|
@ -58,6 +58,7 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthUtil;
|
|||
* Sept 17, 2013 2383 bgonzale Switched back to start from ceiling and end from floor.
|
||||
* Constrain start and end keys by each other.
|
||||
* Dec 3, 2013 1736 dhladky Bandwidth bucket size attenuation.
|
||||
* Jan 25, 2014 2741 dhladky Unsafe nullpointer being thrown.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -244,14 +245,16 @@ public class InMemoryBandwidthBucketDao implements IBandwidthBucketDao {
|
|||
final NavigableMap<Long, BandwidthBucket> buckets = allBuckets
|
||||
.get(network);
|
||||
Long firstKey = buckets.floorKey(key);
|
||||
if (firstKey < keyConstraint) {
|
||||
// then go back to key before this one
|
||||
firstKey = buckets.ceilingKey(key);
|
||||
if (firstKey != null) {
|
||||
if (firstKey < keyConstraint) {
|
||||
// then go back to key before this one
|
||||
firstKey = buckets.ceilingKey(key);
|
||||
}
|
||||
}
|
||||
// safety check
|
||||
if (firstKey == null) {
|
||||
firstKey = buckets.firstKey();
|
||||
}
|
||||
|
||||
return firstKey;
|
||||
}
|
||||
|
||||
|
@ -267,14 +270,16 @@ public class InMemoryBandwidthBucketDao implements IBandwidthBucketDao {
|
|||
final NavigableMap<Long, BandwidthBucket> buckets = allBuckets
|
||||
.get(network);
|
||||
Long lastKey = buckets.ceilingKey(key);
|
||||
if (lastKey > keyConstraint) {
|
||||
// then go back to key before this one
|
||||
lastKey = buckets.floorKey(key);
|
||||
if (lastKey != null) {
|
||||
if (lastKey > keyConstraint) {
|
||||
// then go back to key before this one
|
||||
lastKey = buckets.floorKey(key);
|
||||
}
|
||||
}
|
||||
// safety check
|
||||
if (lastKey == null) {
|
||||
lastKey = buckets.lastKey();
|
||||
lastKey = buckets.lastKey();
|
||||
}
|
||||
|
||||
return lastKey;
|
||||
}
|
||||
|
||||
|
|
|
@ -68,13 +68,17 @@ public class RetrievalGeneratorUtilities {
|
|||
public static boolean findDuplicateUri(String dataUri, String plugin) {
|
||||
|
||||
boolean isDuplicate = false;
|
||||
String sql = "select id from " + plugin + " where datauri = '"
|
||||
+ dataUri + "'";
|
||||
try {
|
||||
String sql = "select id from " + plugin + " where datauri = '"
|
||||
+ dataUri + "'";
|
||||
|
||||
CoreDao dao = new CoreDao(DaoConfig.forDatabase("metadata"));
|
||||
Object[] results = dao.executeSQLQuery(sql);
|
||||
if (results.length > 0) {
|
||||
isDuplicate = true;
|
||||
CoreDao dao = new CoreDao(DaoConfig.forDatabase("metadata"));
|
||||
Object[] results = dao.executeSQLQuery(sql);
|
||||
if (results.length > 0) {
|
||||
isDuplicate = true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
statusHandler.error("Couldn't determine duplicate status! ", e);
|
||||
}
|
||||
|
||||
return isDuplicate;
|
||||
|
|
Loading…
Add table
Reference in a new issue