Skip to content

Commit 10572a6

Browse files
committed
small cleanup
1 parent 8c99115 commit 10572a6

1 file changed

Lines changed: 13 additions & 17 deletions

File tree

src/main/java/org/htmlunit/WebConsole.java

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ public Logger getLogger() {
166166
public void print(final Context cx, final VarScope scope, final Level level,
167167
final Object[] args, final ScriptStackElement[] stack) {
168168
switch (level) {
169-
case TRACE:
169+
case TRACE -> {
170170
if (logger_.isInfoEnabled()) {
171171
String msg = format(cx, scope, args);
172172
if (stack != null) {
@@ -184,37 +184,34 @@ public void print(final Context cx, final VarScope scope, final Level level,
184184
}
185185
logger_.info(msg);
186186
}
187-
break;
188-
case DEBUG:
187+
}
188+
case DEBUG -> {
189189
if (logger_.isDebugEnabled()) {
190190
logger_.debug(format(cx, scope, args));
191191
}
192-
break;
193-
case INFO:
192+
}
193+
case INFO -> {
194194
if (logger_.isInfoEnabled()) {
195195
logger_.info(format(cx, scope, args));
196196
}
197-
break;
198-
case WARN:
197+
}
198+
case WARN -> {
199199
if (logger_.isWarnEnabled()) {
200200
logger_.warn(format(cx, scope, args));
201201
}
202-
break;
203-
case ERROR:
202+
}
203+
case ERROR -> {
204204
if (logger_.isErrorEnabled()) {
205205
logger_.error(format(cx, scope, args));
206206
}
207-
break;
208-
209-
default:
210-
break;
207+
}
208+
default -> { /* skip */ }
211209
}
212210
}
213211

214212
private static String format(final Context cx, final VarScope scope, final Object[] args) {
215-
String msg = NativeConsole.format(cx, scope, args);
216-
msg = msg.replaceAll("\\r?\\n", "\n");
217-
return msg;
213+
final String msg = NativeConsole.format(cx, scope, args);
214+
return msg.replaceAll("\\r?\\n", "\n");
218215
}
219216

220217
private void readObject(final ObjectInputStream ois) throws ClassNotFoundException, IOException {
@@ -233,7 +230,6 @@ private static class DefaultLogger implements Logger {
233230
* Ctor.
234231
*/
235232
DefaultLogger(final Log logger) {
236-
super();
237233
webConsoleLogger_ = logger;
238234
}
239235

0 commit comments

Comments
 (0)