Skip to content

Commit 59bcaaf

Browse files
committed
Polish
1 parent 87a485f commit 59bcaaf

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/info/ProcessInfo.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,12 @@ public VirtualThreadsInfo getVirtualThreads() {
111111
}
112112
}
113113

114+
@SuppressWarnings("unchecked")
115+
private <T> T invokeMethod(Class<?> mxbeanClass, Object mxbean, String name) throws ReflectiveOperationException {
116+
Method method = mxbeanClass.getMethod(name);
117+
return (T) method.invoke(mxbean);
118+
}
119+
114120
public long getPid() {
115121
return this.pid;
116122
}
@@ -123,12 +129,6 @@ public String getOwner() {
123129
return this.owner;
124130
}
125131

126-
@SuppressWarnings("unchecked")
127-
private <T> T invokeMethod(Class<?> mxbeanClass, Object mxbean, String name) throws ReflectiveOperationException {
128-
Method method = mxbeanClass.getMethod(name);
129-
return (T) method.invoke(mxbean);
130-
}
131-
132132
/**
133133
* Virtual threads information.
134134
*

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystem.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -495,8 +495,7 @@ private void addOnErrorConsoleStatusListener(LoggerContext context) {
495495
FilteringStatusListener listener = new FilteringStatusListener(new OnErrorConsoleStatusListener(),
496496
Status.ERROR);
497497
listener.setContext(context);
498-
boolean effectivelyAdded = context.getStatusManager().add(listener);
499-
if (effectivelyAdded) {
498+
if (context.getStatusManager().add(listener)) {
500499
listener.start();
501500
}
502501
}

spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackLoggingSystemTests.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,10 +678,12 @@ void logbackErrorStatusListenerShouldBeRegistered(CapturedOutput output) {
678678
assertThat(statusListener).hasFieldOrPropertyWithValue("levelThreshold", Status.ERROR);
679679
assertThat(statusListener).extracting("delegate").isInstanceOf(OnErrorConsoleStatusListener.class);
680680
AppenderBase<ILoggingEvent> appender = new AppenderBase<>() {
681+
681682
@Override
682683
protected void append(ILoggingEvent eventObject) {
683684
throw new IllegalStateException("Fail to append");
684685
}
686+
685687
};
686688
this.logger.addAppender(appender);
687689
appender.setContext(loggerContext);

0 commit comments

Comments
 (0)