From 75cd287ab0b7ccc302543cf121daf1c051cdfe63 Mon Sep 17 00:00:00 2001 From: DennisOSRM Date: Wed, 19 Sep 2012 17:06:35 +0200 Subject: [PATCH] Partially fixes issue #420 --- DataStructures/NNGrid.h | 2 ++ Server/DataStructures/QueryObjectsStorage.cpp | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/DataStructures/NNGrid.h b/DataStructures/NNGrid.h index e35fa2b25..988e52cbb 100644 --- a/DataStructures/NNGrid.h +++ b/DataStructures/NNGrid.h @@ -68,6 +68,8 @@ public: iif = std::string(_i); ramIndexTable.resize((1024*1024), ULONG_MAX); ramInFile.open(rif, std::ios::in | std::ios::binary); + if(!ramInFile) { ERR(rif << " not found"); } + } ~NNGrid() { diff --git a/Server/DataStructures/QueryObjectsStorage.cpp b/Server/DataStructures/QueryObjectsStorage.cpp index a9ec8d788..7efe9fde9 100644 --- a/Server/DataStructures/QueryObjectsStorage.cpp +++ b/Server/DataStructures/QueryObjectsStorage.cpp @@ -25,6 +25,7 @@ or see http://www.gnu.org/licenses/agpl.txt. QueryObjectsStorage::QueryObjectsStorage(std::string hsgrPath, std::string ramIndexPath, std::string fileIndexPath, std::string nodesPath, std::string edgesPath, std::string namesPath, std::string timestampPath) { INFO("loading graph data"); std::ifstream hsgrInStream(hsgrPath.c_str(), std::ios::binary); + if(!hsgrInStream) { ERR(hsgrPath << " not found"); } //Deserialize road network graph std::vector< QueryGraph::_StrNode> nodeList; std::vector< QueryGraph::_StrEdge> edgeList; @@ -36,8 +37,10 @@ QueryObjectsStorage::QueryObjectsStorage(std::string hsgrPath, std::string ramIn assert(0 == edgeList.size()); if(timestampPath.length()) { - INFO("Loading Timestamp") - std::ifstream timestampInStream(timestampPath.c_str()); + INFO("Loading Timestamp"); + std::ifstream timestampInStream(timestampPath.c_str()); + if(!timestampInStream) { ERR(timestampPath << " not found"); } + getline(timestampInStream, timestamp); timestampInStream.close(); } @@ -49,13 +52,16 @@ QueryObjectsStorage::QueryObjectsStorage(std::string hsgrPath, std::string ramIn INFO("Loading auxiliary information"); //Init nearest neighbor data structure std::ifstream nodesInStream(nodesPath.c_str(), std::ios::binary); + if(!nodesInStream) { ERR(nodesPath << " not found"); } std::ifstream edgesInStream(edgesPath.c_str(), std::ios::binary); + if(!edgesInStream) { ERR(edgesPath << " not found"); } nodeHelpDesk = new NodeInformationHelpDesk(ramIndexPath.c_str(), fileIndexPath.c_str(), n, checkSum); nodeHelpDesk->initNNGrid(nodesInStream, edgesInStream); //deserialize street name list INFO("Loading names index"); std::ifstream namesInStream(namesPath.c_str(), std::ios::binary); + if(!namesInStream) { ERR(namesPath << " not found"); } unsigned size(0); namesInStream.read((char *)&size, sizeof(unsigned)); // names = new std::vector();