Skip to content

Commit 0d79d98

Browse files
File Rename JavaLoggerLevel -> ESAPIErrorJavaLevel
Trying to update the name to be more representative to what it is.
1 parent 978e409 commit 0d79d98

File tree

4 files changed

+46
-31
lines changed

4 files changed

+46
-31
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/**
2+
* OWASP Enterprise Security API (ESAPI)
3+
*
4+
* This file is part of the Open Web Application Security Project (OWASP)
5+
* Enterprise Security API (ESAPI) project. For details, please see
6+
* <a href="http://www.owasp.org/index.php/ESAPI">http://www.owasp.org/index.php/ESAPI</a>.
7+
*
8+
* Copyright (c) 2007 - The OWASP Foundation
9+
*
10+
* The ESAPI is published by OWASP under the BSD license. You should read and accept the
11+
* LICENSE before you use, modify, and/or redistribute this software.
12+
*
13+
* @created 2019
14+
*/
15+
16+
package org.owasp.esapi.logging.java;
17+
18+
import java.util.logging.Level;
19+
20+
/**
21+
* A custom logging level defined between Level.SEVERE and Level.WARNING in logger.
22+
*/
23+
public class ESAPIErrorJavaLevel extends Level {
24+
25+
protected static final long serialVersionUID = 1L;
26+
27+
/**
28+
* Defines a custom error level below SEVERE but above WARNING since this level isn't defined directly
29+
* by java.util.Logger already.
30+
*/
31+
public static final Level ERROR_LEVEL = new ESAPIErrorJavaLevel( "ERROR", Level.SEVERE.intValue() - 1);
32+
33+
/**
34+
* Constructs an instance of a JavaLoggerLevel which essentially provides a mapping between the name of
35+
* the defined level and its numeric value.
36+
*
37+
* @param name The name of the JavaLoggerLevel
38+
* @param value The associated numeric value
39+
*/
40+
private ESAPIErrorJavaLevel(String name, int value) {
41+
super(name, value);
42+
}
43+
}
44+

src/main/java/org/owasp/esapi/logging/java/JavaLogLevelHandlers.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public enum JavaLogLevelHandlers implements JavaLogLevelHandler {
1313
FINER(Level.FINER),
1414
FINEST(Level.FINEST),
1515
ALL(Level.ALL),
16-
ERROR(JavaLoggerLevel.ERROR_LEVEL);
16+
ERROR(ESAPIErrorJavaLevel.ERROR_LEVEL);
1717

1818
private final Level level;
1919

src/main/java/org/owasp/esapi/logging/java/JavaLoggerLevel.java

Lines changed: 0 additions & 29 deletions
This file was deleted.

src/test/java/org/owasp/esapi/logging/java/JavaLogLevelHandlersTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public void testErrorDelegation() {
3636
JavaLogLevelHandlers.ERROR.log(mockLogger, testName.getMethodName());
3737
JavaLogLevelHandlers.ERROR.log(mockLogger, testName.getMethodName(), testException);
3838

39-
Level expectedJavaLevel = JavaLoggerLevel.ERROR_LEVEL;
39+
Level expectedJavaLevel = ESAPIErrorJavaLevel.ERROR_LEVEL;
4040

4141
Mockito.verify(mockLogger, Mockito.times(1)).isLoggable(expectedJavaLevel);
4242
Mockito.verify(mockLogger, Mockito.times(1)).log(expectedJavaLevel, testName.getMethodName());

0 commit comments

Comments
 (0)