Skip to content

Commit ef08b4e

Browse files
devonfw#404: fixed WireMock tests
added null checks to IdeLoggerAdapter debug methods
1 parent c7b170a commit ef08b4e

File tree

1 file changed

+29
-8
lines changed

1 file changed

+29
-8
lines changed

cli/src/main/java/com/devonfw/tools/ide/serviceprovider/IdeLoggerAdapter.java

+29-8
Original file line numberDiff line numberDiff line change
@@ -90,37 +90,56 @@ public void trace(Marker marker, String s, Throwable throwable) {
9090

9191
@Override
9292
public boolean isDebugEnabled() {
93-
return loggingContext.debug().isEnabled();
93+
if (loggingContext != null) {
94+
return loggingContext.debug().isEnabled();
95+
} else {
96+
return false;
97+
}
98+
9499
}
95100

96101
@Override
97102
public void debug(String s) {
98-
loggingContext.debug(s);
103+
if (loggingContext != null) {
104+
loggingContext.debug(s);
105+
}
99106
}
100107

101108
@Override
102109
public void debug(String s, Object o) {
103-
loggingContext.debug(s, o);
110+
if (loggingContext != null) {
111+
loggingContext.debug(s, o);
112+
}
104113
}
105114

106115
@Override
107116
public void debug(String s, Object o, Object o1) {
108-
loggingContext.debug(s, o, o1);
117+
if (loggingContext != null) {
118+
loggingContext.debug(s, o, o1);
119+
}
109120
}
110121

111122
@Override
112123
public void debug(String s, Object... objects) {
113-
loggingContext.debug(s, objects);
124+
if (loggingContext != null) {
125+
loggingContext.debug(s, objects);
126+
}
114127
}
115128

116129
@Override
117130
public void debug(String s, Throwable throwable) {
118-
loggingContext.debug(s, throwable);
131+
if (loggingContext != null) {
132+
loggingContext.debug(s, throwable);
133+
}
119134
}
120135

121136
@Override
122137
public boolean isDebugEnabled(Marker marker) {
123-
return loggingContext.debug().isEnabled();
138+
if (loggingContext != null) {
139+
return loggingContext.debug().isEnabled();
140+
} else {
141+
return false;
142+
}
124143
}
125144

126145
@Override
@@ -170,7 +189,9 @@ public void info(String s, Object o, Object o1) {
170189

171190
@Override
172191
public void info(String s, Object... objects) {
173-
loggingContext.info(s, objects);
192+
if (loggingContext != null) {
193+
loggingContext.info(s, objects);
194+
}
174195
}
175196

176197
@Override

0 commit comments

Comments
 (0)