• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ClassCastException when using email activate registration

 
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, does anyone else has this problem? Any hint?

When user activate the registration var request:
http://10.1.1.96:8000/jforum/user/activateAccount/d0dfa7sjba4ed3040c1eb37ff8ef49e4a6/3.page

I got
12:19:27,621 ERROR [ExceptionWriter ] java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.lang.String
at net.jforum.context.web.WebRequestContext.getParameter(WebRequestContext.java:333)
at net.jforum.context.web.WebRequestContext.getModule(WebRequestContext.java:459)
at net.jforum.JForum.service(JForum.java:167)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

By looking at the code,
public String getParameter(String parameter)
{
return (String)this.query.get(parameter);
}

The parameter is a array. Is this a bug or something I did wrong?

Thanks


[originally posted on jforum.net by kevinread]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This only happened when there is invalid url passed in. So the parameters is actually a ArrayList.

I hacked the problem by do ing following on:
net.jforum.context.web.WebRequestContext

public String getParameter(String parameter)
{
Object obj = this.query.get(parameter);
if (obj instanceof java.util.ArrayList) {
java.util.ArrayList obj2 = (java.util.ArrayList)obj;
return (String)obj2.get(0);
}
return (String)this.query.get(parameter);
}
Now at least I got a nice error screen instead of nasty error.



[originally posted on jforum.net by kevinread]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is the suggested fix for this problem:

https://coderanch.com/t/578221 #19661
[originally posted on jforum.net by monroe]
 
reply
    Bookmark Topic Watch Topic
  • New Topic