string result = ReadFile("/opt/usr/home/owner/share/tct/preconfigure.json");
int index = 0;
string[] resultArray = StringParser(result);
+
+ if (resultArray == null)
+ {
+ LogUtils.Write(LogUtils.ERROR, LogUtils.TAG, "StringParser failed " + result);
+ return;
+ }
+
foreach (string item in resultArray)
{
switch (item)
{
string result = null;
string url = path;
+ StreamReader reader = null;
try
{
- StreamReader reader = File.OpenText(path);
+ reader = File.OpenText(path);
result = reader.ReadToEnd();
}
catch (Exception e)
{
LogUtils.Write(LogUtils.ERROR, LogUtils.TAG, "File read error : " + e.Message);
}
-
+ finally
+ {
+ if (reader != null)
+ {
+ reader.Dispose();
+ }
+ }
return result;
}
private static string[] StringParser(string TCID)