1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package com.xpn.xwiki; |
21 |
|
|
22 |
|
import java.io.FileInputStream; |
23 |
|
import java.io.FileNotFoundException; |
24 |
|
import java.io.IOException; |
25 |
|
import java.io.InputStream; |
26 |
|
import java.util.Properties; |
27 |
|
|
28 |
|
import org.apache.commons.io.IOUtils; |
29 |
|
import org.apache.commons.lang3.StringUtils; |
30 |
|
|
31 |
|
import com.xpn.xwiki.internal.XWikiCfgConfigurationSource; |
32 |
|
|
33 |
|
|
34 |
|
@deprecated@link |
35 |
|
|
36 |
|
@Deprecated |
|
|
| 56% |
Uncovered Elements: 11 (25) |
Complexity: 10 |
Complexity Density: 0.62 |
|
37 |
|
public class XWikiConfig extends Properties |
38 |
|
{ |
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
39 |
17343 |
public XWikiConfig()... |
40 |
|
{ |
41 |
|
|
42 |
|
|
43 |
|
} |
44 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.29 |
|
45 |
0 |
public XWikiConfig(String path) throws XWikiException... |
46 |
|
{ |
47 |
0 |
try { |
48 |
0 |
FileInputStream fis = new FileInputStream(path); |
49 |
0 |
try { |
50 |
0 |
loadConfig(fis, path); |
51 |
|
} finally { |
52 |
0 |
IOUtils.closeQuietly(fis); |
53 |
|
} |
54 |
|
} catch (FileNotFoundException e) { |
55 |
0 |
Object[] args = { path }; |
56 |
0 |
throw new XWikiException(XWikiException.MODULE_XWIKI_CONFIG, |
57 |
|
XWikiException.ERROR_XWIKI_CONFIG_FILENOTFOUND, "Configuration file {0} not found", e, args); |
58 |
|
} |
59 |
|
} |
60 |
|
|
|
|
| 75% |
Uncovered Elements: 1 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
61 |
30 |
public XWikiConfig(InputStream is) throws XWikiException... |
62 |
|
{ |
63 |
30 |
if (is != null) { |
64 |
30 |
loadConfig(is, ""); |
65 |
|
} |
66 |
|
} |
67 |
|
|
|
|
| 50% |
Uncovered Elements: 2 (4) |
Complexity: 2 |
Complexity Density: 0.5 |
|
68 |
30 |
public void loadConfig(InputStream is, String path) throws XWikiException... |
69 |
|
{ |
70 |
30 |
try { |
71 |
30 |
load(is); |
72 |
|
} catch (IOException e) { |
73 |
0 |
Object[] args = { path }; |
74 |
0 |
throw new XWikiException(XWikiException.MODULE_XWIKI_CONFIG, XWikiException.ERROR_XWIKI_CONFIG_FORMATERROR, |
75 |
|
"Error reading configuration file", e, args); |
76 |
|
} |
77 |
|
} |
78 |
|
|
79 |
|
|
80 |
|
@return |
81 |
|
@param |
82 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
83 |
212 |
public String[] getPropertyAsList(String param)... |
84 |
|
{ |
85 |
212 |
return StringUtils.split(getProperty(param, ""), " ,"); |
86 |
|
} |
87 |
|
|
88 |
|
|
89 |
|
@inheritDoc |
90 |
|
|
91 |
|
|
92 |
|
|
93 |
|
|
94 |
|
@see |
95 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
96 |
13 |
@Override... |
97 |
|
public String getProperty(String key, String defaultValue) |
98 |
|
{ |
99 |
13 |
return StringUtils.trim(super.getProperty(key, defaultValue)); |
100 |
|
} |
101 |
|
|
102 |
|
|
103 |
|
@inheritDoc |
104 |
|
|
105 |
|
|
106 |
|
|
107 |
|
|
108 |
|
@see |
109 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
110 |
69959 |
@Override... |
111 |
|
public String getProperty(String key) |
112 |
|
{ |
113 |
69959 |
return StringUtils.trim(super.getProperty(key)); |
114 |
|
} |
115 |
|
} |