Skip to content

Commit ec1b016

Browse files
committed
Improve unsupported operation messages in GenericWAC
1 parent 5ebabcf commit ec1b016

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

org.springframework.web/src/main/java/org/springframework/web/context/support/GenericWebApplicationContext.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -194,35 +194,38 @@ public void setServletConfig(ServletConfig servletConfig) {
194194
}
195195

196196
public ServletConfig getServletConfig() {
197-
throw new UnsupportedOperationException();
197+
throw new UnsupportedOperationException(
198+
"GenericWebApplicationContext does not support getServletConfig()");
198199
}
199200

200201
public void setNamespace(String namespace) {
201202
// no-op
202203
}
203204

204205
public String getNamespace() {
205-
throw new UnsupportedOperationException();
206+
throw new UnsupportedOperationException(
207+
"GenericWebApplicationContext does not support getNamespace()");
206208
}
207209

208210
public void setConfigLocation(String configLocation) {
209211
if (StringUtils.hasText(configLocation)) {
210212
throw new UnsupportedOperationException(
211-
"GenericWebApplicationContext does not support configLocation. Do " +
212-
"you still have an 'contextConfigLocations' init-param set?");
213+
"GenericWebApplicationContext does not support setConfigLocation(). " +
214+
"Do you still have an 'contextConfigLocations' init-param set?");
213215
}
214216
}
215217

216218
public void setConfigLocations(String[] configLocations) {
217219
if (!ObjectUtils.isEmpty(configLocations)) {
218220
throw new UnsupportedOperationException(
219-
"GenericWebApplicationContext does not support configLocations. Do " +
220-
"you still have an 'contextConfigLocations' init-param set?");
221+
"GenericWebApplicationContext does not support setConfigLocations(). " +
222+
"Do you still have an 'contextConfigLocations' init-param set?");
221223
}
222224
}
223225

224226
public String[] getConfigLocations() {
225-
throw new UnsupportedOperationException();
227+
throw new UnsupportedOperationException(
228+
"GenericWebApplicationContext does not support getConfigLocations()");
226229
}
227230

228231
}

0 commit comments

Comments
 (0)