Closed spring-projects-issues closed 20 years ago
Juergen Hoeller commented
Thanks, just fixed - obviously, specifying required properties for Servlet init-params is a completely unused feature... On the occasion, I've renamed the "setRequiredProperty" method to the more appropriate name "addRequiredProperty". Juergen
Edward Weatherley opened SPR-90 and commented
One of our framework servlets, which has a required property, throws the following exception on startup:
06/04/04 16:43 www: Error initializing servlet java.lang.UnsupportedOperationException at java.util.AbstractList.remove(AbstractList.java:171) at java.util.AbstractList$Itr.remove(AbstractList.java:436) at java.util.AbstractCollection.remove(AbstractCollection.java:255) at org.springframework.web.servlet.ServletConfigPropertyValues.\(ServletConfigPropertyValues.java:62)
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:79)
at javax.servlet.GenericServlet.init(GenericServlet.java:44)
at com.evermind._ay._lke(.:1672)
...
The root of the problem appears to be the following code in the ServletConfigPropertyValues constructor:
List missingProps = ... Arrays.asList(requiredProperties) ...;
...
if (missingProps != null) { missingProps.remove(property); }
As the size of the array returned by Arrays.asList cannot be changed, the call to remove() throws an UnsupportedOperationException.
The easiest fix would probably to stick the missingProps into an ArrayList or HashSet.
Affects: 1.0 final