53 |
53 |
54 // logging for debug purposes |
54 // logging for debug purposes |
55 private PrintStream log; |
55 private PrintStream log; |
56 |
56 |
57 public SdpProvider() { |
57 public SdpProvider() { |
|
58 Properties props = GetPropertyAction.privilegedGetProperties(); |
58 // if this property is not defined then there is nothing to do. |
59 // if this property is not defined then there is nothing to do. |
59 String file = GetPropertyAction.getProperty("com.sun.sdp.conf"); |
60 String file = props.getProperty("com.sun.sdp.conf"); |
60 if (file == null) { |
61 if (file == null) { |
61 this.enabled = false; |
62 this.enabled = false; |
62 this.rules = null; |
63 this.rules = null; |
63 return; |
64 return; |
64 } |
65 } |
65 |
66 |
66 // load configuration file |
67 // load configuration file |
67 List<Rule> list = null; |
68 List<Rule> list = null; |
68 if (file != null) { |
69 try { |
69 try { |
70 list = loadRulesFromFile(file); |
70 list = loadRulesFromFile(file); |
71 } catch (IOException e) { |
71 } catch (IOException e) { |
72 fail("Error reading %s: %s", file, e.getMessage()); |
72 fail("Error reading %s: %s", file, e.getMessage()); |
|
73 } |
|
74 } |
73 } |
75 |
74 |
76 // check if debugging is enabled |
75 // check if debugging is enabled |
77 PrintStream out = null; |
76 PrintStream out = null; |
78 String logfile = GetPropertyAction.getProperty("com.sun.sdp.debug"); |
77 String logfile = props.getProperty("com.sun.sdp.debug"); |
79 if (logfile != null) { |
78 if (logfile != null) { |
80 out = System.out; |
79 out = System.out; |
81 if (logfile.length() > 0) { |
80 if (logfile.length() > 0) { |
82 try { |
81 try { |
83 out = new PrintStream(logfile); |
82 out = new PrintStream(logfile); |