summaryrefslogtreecommitdiff
path: root/cpp/src/IceGrid/AdminSessionI.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/IceGrid/AdminSessionI.cpp')
-rw-r--r--cpp/src/IceGrid/AdminSessionI.cpp25
1 files changed, 13 insertions, 12 deletions
diff --git a/cpp/src/IceGrid/AdminSessionI.cpp b/cpp/src/IceGrid/AdminSessionI.cpp
index b30a1ecddf8..44a634abd5d 100644
--- a/cpp/src/IceGrid/AdminSessionI.cpp
+++ b/cpp/src/IceGrid/AdminSessionI.cpp
@@ -315,19 +315,20 @@ AdminSessionI::addFileIterator(const FileReaderPrx& reader,
throw ex;
}
- Ice::Long offset = 0;
- if(nLines > 0)
+ //
+ // Always call getOffsetFromEnd even if nLines < 0. This allows to
+ // throw right away if the file doesn't exit.
+ //
+ Ice::Long offset;
+ try
{
- try
- {
- offset = reader->getOffsetFromEnd(filename, nLines);
- }
- catch(const Ice::LocalException& ex)
- {
- ostringstream os;
- os << ex;
- throw FileNotAvailableException(os.str());
- }
+ offset = reader->getOffsetFromEnd(filename, nLines);
+ }
+ catch(const Ice::LocalException& ex)
+ {
+ ostringstream os;
+ os << ex;
+ throw FileNotAvailableException(os.str());
}
Ice::PropertiesPtr properties = reader->ice_getCommunicator()->getProperties();