diff options
author | Shaun Verch <shaun.verch@10gen.com> | 2013-12-28 17:42:36 -0800 |
---|---|---|
committer | Shaun Verch <shaun.verch@10gen.com> | 2013-12-30 10:46:52 -0800 |
commit | 1b599c9f17c6dd10b320e5d642a03604164aec2d (patch) | |
tree | 2e227c571da9aecd9f8841feb4d0cfac4a494993 /src/mongo/tools | |
parent | 67573b22240f455ed425ed040b6f0ac1a7077b74 (diff) | |
download | mongo-1b599c9f17c6dd10b320e5d642a03604164aec2d.tar.gz |
SERVER-12165 Only fallback on using the file name when a file name is actually specified
Diffstat (limited to 'src/mongo/tools')
-rw-r--r-- | src/mongo/tools/import.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/mongo/tools/import.cpp b/src/mongo/tools/import.cpp index d1cc3582468..d87fe1209e2 100644 --- a/src/mongo/tools/import.cpp +++ b/src/mongo/tools/import.cpp @@ -362,9 +362,10 @@ public: try { ns = getNS(); } - catch (int e) { - if (e == -1) { - // no collection specified - use name of collection that was dumped from + catch (...) { + // The only time getNS throws is when the collection was not specified. In that case, + // check if the user specified a file name and use that as the collection name. + if (!mongoImportGlobalParams.filename.empty()) { string oldCollName = boost::filesystem::path(mongoImportGlobalParams.filename).leaf().string(); oldCollName = oldCollName.substr( 0 , oldCollName.find_last_of( "." ) ); @@ -376,10 +377,6 @@ public: return -1; } } - catch (...) { - printHelp(cerr); - return -1; - } if (logger::globalLogDomain()->shouldLog(logger::LogSeverity::Debug(1))) { toolInfoLog() << "ns: " << ns << endl; |