Issue #1064 Fixed issue with grib splitter writing to nonexistent directories
Change-Id: I2b0246d3589074c29606a030f317d825cfc5f2e3 Former-commit-id:e69aa93735
[formerly04389b9f21
] [formerlya501aacb3b
] [formerlya5c57e8d24
[formerlya501aacb3b
[formerly ccb9b1b4e9caf8523706535b141b0e54dd798c70]]] Former-commit-id:a5c57e8d24
Former-commit-id: 6425b9202293405230f8ab681a2ceb8043b34140 [formerlyc7bc786a60
] Former-commit-id:5d988cc5c1
This commit is contained in:
parent
f204baba47
commit
a7872b1c6d
1 changed files with 32 additions and 3 deletions
|
@ -48,6 +48,8 @@ import com.raytheon.uf.edex.python.decoder.PythonDecoder;
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* 3/12/10 4758 bphillip Initial creation
|
* 3/12/10 4758 bphillip Initial creation
|
||||||
|
* 8/15/12 1064 bphillip Added code to ensure the destination folders for large file splits are
|
||||||
|
* present
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author njensen
|
* @author njensen
|
||||||
|
@ -55,10 +57,38 @@ import com.raytheon.uf.edex.python.decoder.PythonDecoder;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class GribDecoder {
|
public class GribDecoder {
|
||||||
private static final transient IUFStatusHandler statusHandler = UFStatus.getHandler(GribDecoder.class);
|
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||||
|
.getHandler(GribDecoder.class);
|
||||||
|
|
||||||
|
/** The size limit for grib files before an attempt is made to split them */
|
||||||
private static final long TEN_MEGABYTES = 10485760;
|
private static final long TEN_MEGABYTES = 10485760;
|
||||||
|
|
||||||
|
/** The directory which split grib 1 files are written to */
|
||||||
|
private static final File LARGE_GRIB1_DIR = new File(
|
||||||
|
System.getProperty("edex.home")
|
||||||
|
+ "/data/manual/grib/grib1LargeSplit/");
|
||||||
|
|
||||||
|
/** The directory which split grib2 files are written to */
|
||||||
|
private static final File LARGE_GRIB2_DIR = new File(
|
||||||
|
System.getProperty("edex.home")
|
||||||
|
+ "/data/manual/grib/grib2LargeSplit/");
|
||||||
|
|
||||||
|
static {
|
||||||
|
/*
|
||||||
|
* Ensure the grib1 split output directory exists
|
||||||
|
*/
|
||||||
|
if (!LARGE_GRIB1_DIR.exists()) {
|
||||||
|
LARGE_GRIB1_DIR.mkdirs();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Ensure the grib2 split output directory exists
|
||||||
|
*/
|
||||||
|
if (!LARGE_GRIB2_DIR.exists()) {
|
||||||
|
LARGE_GRIB2_DIR.mkdirs();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public GribDecoder() {
|
public GribDecoder() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -136,7 +166,7 @@ public class GribDecoder {
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
statusHandler.handle(Priority.ERROR, "Failed to decode file: ["
|
statusHandler.handle(Priority.ERROR, "Failed to decode file: ["
|
||||||
+ file.getAbsolutePath() + "]", e);
|
+ file.getAbsolutePath() + "]", e);
|
||||||
records = new GribRecord[0];
|
records = new GribRecord[0];
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
try {
|
||||||
|
@ -176,7 +206,6 @@ public class GribDecoder {
|
||||||
out = new FileOutputStream(System.getProperty("edex.home")
|
out = new FileOutputStream(System.getProperty("edex.home")
|
||||||
+ "/data/manual/grib/grib" + edition + "LargeSplit/" + fileName + "_record_" + (i + 1));
|
+ "/data/manual/grib/grib" + edition + "LargeSplit/" + fileName + "_record_" + (i + 1));
|
||||||
out.write(transfer);
|
out.write(transfer);
|
||||||
out.close();
|
|
||||||
} finally {
|
} finally {
|
||||||
if (out != null) {
|
if (out != null) {
|
||||||
out.close();
|
out.close();
|
||||||
|
|
Loading…
Add table
Reference in a new issue