I'm trying to run some code I saw used at Javaworld.com, and I get a runtime error in the process, and I'm not sure how to combat it. Here's a snippet of the code:
publicstatic String getRequestParameters(HttpServletRequest aRequest) {
StringBuffer aReturn = new StringBuffer("");
Map m = aRequest.getParameterMap();
Set aEntryS = m.entrySet();
Iterator aEntryI = aEntryS.iterator();
while (aEntryI.hasNext()) {
Map.Entry aEntry = (Map.Entry) aEntryI.next();
List aValues = (List) aEntry.getValue();
for (int i=0; i< aValues.size(); i++) {
if (aReturn.length()>0) {
aReturn.append("&");
}
aReturn.append(aEntry.getKey());
aReturn.append("=");
aReturn.append(aValues.get(i));
}
return aReturn.toString();
}
The runtime error I get is a ClassCastException around the "List aValues..." line. I've been over and over this and I don't see the solution - maybe another pair of eyes looking this over could point it out?