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