InputStream is;
int tenantId = getTenantIdForDomain(tenantDomain);
try {
is = getInputStream(logFile, tenantId, serviceName);
} catch (LogViewerException e) {
throw new LogViewerException("Cannot read InputStream from the file " + logFile, e);
}
try {
byte[] c = new byte[1024];
int count = 0;
int readChars = 0;
while ((readChars = is.read(c)) != -1) {
for (int i = 0; i < readChars; ++i) {
if (c[i] == '\n') {
++count;
}
}
}
return count;
} catch (IOException e) {
throw new LogViewerException("Cannot read file size from the " + logFile, e);
} finally {
try {
is.close();
} catch (IOException e) {
throw new LogViewerException("Cannot close the input stream " + logFile, e);
}
}
}