44  {
   45    BufferedReader br = new BufferedReader(new FileReader(filename));
   46    String line = null;
   47 
   48    int errors = 0;
   49    int lines = 0;
   50    boolean ok;
   51 
   52    while ((line = br.readLine()) != null)
   53    {
   54      lines++;
   55      ok = false;
   56 
   57      if (errors > MAX_ERRORS || lines > MAX_LINES)
   58      {
   59        br.close();
   60        throw new IOException("Parsing limits exceeded");
   61      }
   62 
   63      String[] fields = line.split(":", 3);
   64 
   65      if (fields.length == 3)
   66      {
   67        if (fields[1].equals("s"))
   68        {
   69          options.put(fields[0].toLowerCase(Locale.ENGLISH), fields[2]);
   70          ok = true;
   71        }
   72        else if (fields[1].equals("i"))
   73        {
   74          try
   75          {
   76            Integer i = Integer.parseInt(fields[2]);
   77            options.put(fields[0].toLowerCase(Locale.ENGLISH), i);
   78            ok = true;
   79          }
   80          catch (NumberFormatException e)
   81          {
   82          }
   83        }
   84        else if (fields[1].equals("b"))
   85        {
   86          ok = true;
   87        }
   88      }
   89 
   90      if (!ok)
   91        errors++;
   92    }
   93    br.close();
   94  }