Issue #2906 added close to BUFR parser
close netcdf file to solve NFS clean issue (cherry picked from commit 9434b5c653b3a542cc56eac1081f0ab7126966a2 [formerlya1e416da97
] [formerlyabb14c67e7
[formerly5beb3be2e8
] [formerlya1e416da97
[formerly 9675e997369e39455aacadcd72d0d8476f6c7ffc]]]) Former-commit-id:d83882a92c
[formerlybb17c8cfc1
] [formerly80a0bba04e
[formerly 4599660af98619505fa69a53453218f733eeeea6]] Former-commit-id:80a0bba04e
Former-commit-id:5e72d873aa
This commit is contained in:
parent
3d50e30c4a
commit
d2d38805cf
2 changed files with 22 additions and 2 deletions
|
@ -58,6 +58,7 @@ import com.raytheon.uf.common.status.UFStatus;
|
|||
* Mar 26, 2014 2905 bclement fixed types, added scale/offset
|
||||
* Apr 01, 2014 2905 bclement moved splitter functionality to separate utility
|
||||
* added scanForStructField()
|
||||
* Apr 29, 2014 2906 bclement added close()
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -827,4 +828,13 @@ public class BufrParser {
|
|||
return structStack.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* Release resources associated with BUFR file.
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
public void close() throws IOException {
|
||||
this.ncfile.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -44,7 +44,8 @@ import com.raytheon.uf.edex.plugin.bufrobs.category.CategoryKey;
|
|||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 1, 2014 2906 bclement Initial creation
|
||||
* Apr 01, 2014 2906 bclement Initial creation
|
||||
* Apr 29, 2014 2906 bclement close parser when finished
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -69,9 +70,10 @@ public class BufrObsProcessor {
|
|||
*/
|
||||
public PluginDataObject[] process(File bufrFile)
|
||||
throws BufrObsDecodeException {
|
||||
BufrParser parser = null;
|
||||
PluginDataObject[] rval;
|
||||
try {
|
||||
BufrParser parser = new BufrParser(bufrFile);
|
||||
parser = new BufrParser(bufrFile);
|
||||
CategoryKey key = getBufrCategory(parser);
|
||||
AbstractBufrSfcObsDecoder decoder = getDecoder(key);
|
||||
if (decoder == null) {
|
||||
|
@ -86,6 +88,14 @@ public class BufrObsProcessor {
|
|||
} catch (IOException e) {
|
||||
throw new BufrObsDecodeException("Unable to read BUFR file: "
|
||||
+ bufrFile, e);
|
||||
} finally {
|
||||
if (parser != null)
|
||||
try {
|
||||
parser.close();
|
||||
} catch (IOException e) {
|
||||
throw new BufrObsDecodeException(
|
||||
"Unable to close parser for file: " + bufrFile, e);
|
||||
}
|
||||
}
|
||||
return rval;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue