Omaha #3978 use InputStream instead of LocalizationFileInputStream or
read() Change-Id: Ief0137559617f15ac9d7f6510b74630affa5aed5 Former-commit-id: 3a6c19cccad2a8ae2db0a49c47d737a5c5e0436c
This commit is contained in:
parent
bfe2c107ae
commit
29bf0fc879
4 changed files with 31 additions and 21 deletions
|
@ -25,6 +25,7 @@ import java.io.File;
|
|||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
|
@ -50,7 +51,6 @@ import com.raytheon.uf.common.localization.LocalizationContext;
|
|||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
|
||||
import com.raytheon.uf.common.localization.LocalizationFile;
|
||||
import com.raytheon.uf.common.localization.LocalizationFileInputStream;
|
||||
import com.raytheon.uf.common.localization.LocalizationFileOutputStream;
|
||||
import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||
import com.raytheon.uf.common.localization.exception.LocalizationException;
|
||||
|
@ -86,7 +86,8 @@ import com.vividsolutions.jts.geom.LineString;
|
|||
* 07-11-12 #875 rferrel Move points to PointsDataManager.
|
||||
* 01-29-14 DR 16351 D. Friedman Fix updates to storm track from preferences.
|
||||
* 04-02-14 DR 16351 D. Friedman Fix updates to storm track from preferences. (backport from 14.2.2)
|
||||
* 06-03-24 3191 njensen Improved saving/loading storm track data
|
||||
* Jun 03, 2014 3191 njensen Improved saving/loading storm track data
|
||||
* Feb 24, 2015 3978 njensen Changed to use abstract InputStream
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -122,25 +123,25 @@ public class ToolsDataManager implements ILocalizationFileObserver {
|
|||
|
||||
private Map<String, LineString> baselines;
|
||||
|
||||
private ListenerList baselineListeners = new ListenerList();
|
||||
private final ListenerList baselineListeners = new ListenerList();
|
||||
|
||||
private PointsDataManager pointsManager;
|
||||
private final PointsDataManager pointsManager;
|
||||
|
||||
private Collection<RangeRing> rangeRings;
|
||||
|
||||
private StormTrackData stormData;
|
||||
|
||||
private ListenerList stormListeners = new ListenerList();
|
||||
private final ListenerList stormListeners = new ListenerList();
|
||||
|
||||
private Object stormLock = new Object();
|
||||
private final Object stormLock = new Object();
|
||||
|
||||
private boolean stormTrackDirty = false;
|
||||
|
||||
private LocalizationFile userToolsDir;
|
||||
private final LocalizationFile userToolsDir;
|
||||
|
||||
private IPathManager pathMgr;
|
||||
private final IPathManager pathMgr;
|
||||
|
||||
private BlockingQueue<String> baselineStoreQueue = new LinkedBlockingQueue<String>();
|
||||
private final BlockingQueue<String> baselineStoreQueue = new LinkedBlockingQueue<String>();
|
||||
|
||||
public static synchronized ToolsDataManager getInstance() {
|
||||
if (theManager == null) {
|
||||
|
@ -252,7 +253,7 @@ public class ToolsDataManager implements ILocalizationFileObserver {
|
|||
userToolsDir.getContext(), userToolsDir.getName()
|
||||
+ IPathManager.SEPARATOR + STORM_TRACK_FILE);
|
||||
if (f.exists()) {
|
||||
LocalizationFileInputStream is = null;
|
||||
InputStream is = null;
|
||||
try {
|
||||
is = f.openInputStream();
|
||||
stormData = JAXB.unmarshal(is, StormTrackData.class);
|
||||
|
@ -380,7 +381,7 @@ public class ToolsDataManager implements ILocalizationFileObserver {
|
|||
}
|
||||
}
|
||||
|
||||
private Job baselineStoreJob = new Job("Storing Baselines") {
|
||||
private final Job baselineStoreJob = new Job("Storing Baselines") {
|
||||
|
||||
@Override
|
||||
protected IStatus run(IProgressMonitor monitor) {
|
||||
|
|
|
@ -21,9 +21,9 @@ package com.raytheon.uf.common.archive.config;
|
|||
|
||||
import java.io.File;
|
||||
import java.io.FileFilter;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.text.FieldPosition;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
|
@ -59,7 +59,6 @@ import com.raytheon.uf.common.localization.LocalizationContext;
|
|||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
|
||||
import com.raytheon.uf.common.localization.LocalizationFile;
|
||||
import com.raytheon.uf.common.localization.LocalizationFileInputStream;
|
||||
import com.raytheon.uf.common.localization.LocalizationFileOutputStream;
|
||||
import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||
import com.raytheon.uf.common.localization.exception.LocalizationException;
|
||||
|
@ -98,6 +97,8 @@ import com.raytheon.uf.common.util.FileUtil;
|
|||
* Apr 01, 2014 2862 rferrel Moved purge only routines to ArchivePurgeManager.
|
||||
* Apr 29, 2014 3036 rferrel Check for missing archive root directories.
|
||||
* May 22, 2014 3181 rferrel Add check for valid array index.
|
||||
* Feb 24, 2015 3978 njensen Changed to use abstract InputStream
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author rferrel
|
||||
|
@ -910,7 +911,7 @@ public class ArchiveConfigManager {
|
|||
LocalizationFile lFile) throws IOException, LocalizationException,
|
||||
DataBindingException {
|
||||
ArchiveConfig archiveConfig = null;
|
||||
LocalizationFileInputStream stream = null;
|
||||
InputStream stream = null;
|
||||
try {
|
||||
stream = lFile.openInputStream();
|
||||
archiveConfig = JAXB.unmarshal(stream, ArchiveConfig.class);
|
||||
|
@ -954,7 +955,7 @@ public class ArchiveConfigManager {
|
|||
LocalizationFile lFile = pathMgr.getLocalizationFile(siteContext,
|
||||
ARCHIVE_DIR + "/" + fileName);
|
||||
if (lFile.exists()) {
|
||||
FileInputStream stream = null;
|
||||
InputStream stream = null;
|
||||
try {
|
||||
stream = lFile.openInputStream();
|
||||
selections = unmarshallSelectionStream(stream);
|
||||
|
@ -1069,7 +1070,7 @@ public class ArchiveConfigManager {
|
|||
* @return selectConfig
|
||||
* @throws IOException
|
||||
*/
|
||||
private SelectConfig unmarshallSelectionStream(FileInputStream stream)
|
||||
private SelectConfig unmarshallSelectionStream(InputStream stream)
|
||||
throws IOException {
|
||||
SelectConfig selections = null;
|
||||
try {
|
||||
|
|
|
@ -20,9 +20,9 @@
|
|||
package com.raytheon.uf.common.dataplugin.gfe.textproduct;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import com.raytheon.uf.common.localization.LocalizationFile;
|
||||
import com.raytheon.uf.common.localization.exception.LocalizationException;
|
||||
|
@ -44,6 +44,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 23, 2010 randerso Initial creation
|
||||
* Mar 26, 2014 #2884 randerso Code clean up
|
||||
* Feb 24, 2015 3978 njensen Changed to use abstract InputStream
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -117,7 +118,7 @@ public class DraftProduct {
|
|||
throws SerializationException {
|
||||
|
||||
byte[] bytes = null;
|
||||
FileInputStream in = null;
|
||||
InputStream in = null;
|
||||
try {
|
||||
File file = lf.getFile(true);
|
||||
in = lf.openInputStream();
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
**/
|
||||
package com.raytheon.uf.common.dataplugin.warning.gis;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
@ -65,6 +67,7 @@ import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory;
|
|||
* Oct 22, 2013 2361 njensen Use JAXBManager for XML
|
||||
* Jun 17, 2014 DR 17390 Qinglu Lin Updated getMetaDataMap() for lonField and latField.
|
||||
* Aug 21, 2014 3353 rferrel Generating Geo Spatial data set no longer on the UI thread.
|
||||
* Feb 24, 2015 3978 njensen Use openInputStream() for reading file contents
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -292,9 +295,13 @@ public class GeospatialFactory {
|
|||
+ fileName);
|
||||
|
||||
if (lf.exists()) {
|
||||
byte[] data = lf.read();
|
||||
return SerializationUtil.transformFromThrift(
|
||||
GeospatialDataSet.class, data);
|
||||
try (InputStream is = lf.openInputStream()) {
|
||||
return SerializationUtil.transformFromThrift(
|
||||
GeospatialDataSet.class, is);
|
||||
} catch (IOException e) {
|
||||
throw new SerializationException("Error reading file "
|
||||
+ lf.getName(), e);
|
||||
}
|
||||
} else {
|
||||
System.out.println("Attempted to load: " + lf.getName()
|
||||
+ " for site " + site + ", but file does not exist.");
|
||||
|
|
Loading…
Add table
Reference in a new issue