Skip to content

Commit d7bd8d9

Browse files
committed
following the constant naming convention
1 parent bedf022 commit d7bd8d9

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/org/opensolaris/opengrok/authorization/AuthorizationPluginClassLoader.java

+13-13
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public class AuthorizationPluginClassLoader extends ClassLoader {
4646
private final Map<String, Class> cache = new HashMap<>();
4747

4848
private static final Logger LOGGER = LoggerFactory.getLogger(AuthorizationPluginClassLoader.class);
49-
private final static String[] classWhitelist = new String[]{
49+
private final static String[] CLASS_WHITELIST = new String[]{
5050
"org.opensolaris.opengrok.configuration.Group",
5151
"org.opensolaris.opengrok.configuration.Project",
5252
"org.opensolaris.opengrok.configuration.RuntimeEnvironment",
@@ -55,7 +55,7 @@ public class AuthorizationPluginClassLoader extends ClassLoader {
5555
"org.opensolaris.opengrok.logger.*",
5656
};
5757

58-
private final static String[] packageBlacklist = new String[]{
58+
private final static String[] PACKAGE_BLACKLIST = new String[]{
5959
"java",
6060
"javax",
6161
"org.w3c",
@@ -139,8 +139,8 @@ private byte[] loadBytes(InputStream in) throws IOException {
139139
}
140140

141141
private boolean checkWhiteList(String name) {
142-
for (int i = 0; i < classWhitelist.length; i++) {
143-
String pattern = classWhitelist[i];
142+
for (int i = 0; i < CLASS_WHITELIST.length; i++) {
143+
String pattern = CLASS_WHITELIST[i];
144144
pattern = pattern.replaceAll("\\.", "\\\\.");
145145
pattern = pattern.replaceAll("\\*", ".*");
146146
if (name.matches(pattern)) {
@@ -155,18 +155,18 @@ private void checkClassname(String name) throws SecurityException {
155155
&& !checkWhiteList(name)) {
156156
throw new SecurityException("Tried to load a blacklisted class \"" + name + "\"\n"
157157
+ "Allowed classes from opengrok package are only: "
158-
+ Arrays.toString(classWhitelist));
158+
+ Arrays.toString(CLASS_WHITELIST));
159159
}
160160
}
161161

162162
private void checkPackage(String name) throws SecurityException {
163-
for (int i = 0; i < packageBlacklist.length; i++) {
164-
if (name.startsWith(packageBlacklist[i] + ".")) {
163+
for (int i = 0; i < PACKAGE_BLACKLIST.length; i++) {
164+
if (name.startsWith(PACKAGE_BLACKLIST[i] + ".")) {
165165
throw new SecurityException("Tried to load a class \"" + name
166166
+ "\" to a blacklisted package "
167-
+ "\"" + packageBlacklist[i] + "\"\n"
167+
+ "\"" + PACKAGE_BLACKLIST[i] + "\"\n"
168168
+ "Disabled packages are: "
169-
+ Arrays.toString(packageBlacklist));
169+
+ Arrays.toString(PACKAGE_BLACKLIST));
170170
}
171171
}
172172
}
@@ -182,8 +182,8 @@ private void checkPackage(String name) throws SecurityException {
182182
* <li>loading from .jar files</li>
183183
* </ol>
184184
*
185-
* Package blacklist: {@link #packageBlacklist}.<br />
186-
* Classes whitelist: {@link #classWhitelist}.
185+
* Package blacklist: {@link #PACKAGE_BLACKLIST}.<br />
186+
* Classes whitelist: {@link #CLASS_WHITELIST}.
187187
*
188188
* @param name class name
189189
* @return loaded class or null
@@ -206,8 +206,8 @@ public Class loadClass(String name) throws ClassNotFoundException, SecurityExcep
206206
* <li>loading from .jar files</li>
207207
* </ol>
208208
*
209-
* Package blacklist: {@link #packageBlacklist}.<br />
210-
* Classes whitelist: {@link #classWhitelist}.
209+
* Package blacklist: {@link #PACKAGE_BLACKLIST}.<br />
210+
* Classes whitelist: {@link #CLASS_WHITELIST}.
211211
*
212212
* @param name class name
213213
* @param resolveIt if the class should be resolved

0 commit comments

Comments
 (0)