Weird string sum bug in filter
I've got a very strange problem in one of my filter classes.
What happens is this:
//Filter
...
publicvoid init( FilterConfig filterConfig)
{
...
this.errorPage ="test" + Configuration.getErrorPageLocation();
...
}
...
//Configuration class
...
publicstaticfinal String getErrorPageLocation()
{
return"errorpage.jsp";
}
...
This works fine on my local machine, but when i try to deploy this on the webserver (through plesk) i get an error inside plesk that something is wrong in the code.
After alot of debugging I finally came down to this section, which I think is very weird.
Because when I remove the sum of the strings (remove " "test" + ") it works fine.
But whenever I sum up the strings it does not work.
//works
this.errorPage = Configuration.getErrorPageLocation();
//does not work
this.errorPage ="test" + Configuration.getErrorPageLocation();
Anyone knows what this can be?
I've tried a number of things but just can't seem to get it right (i've tried putting it inside a stringbuffer, removing the final, making it non-static, etc.)
Thanks
[1740 byte] By [
radicjesa] at [2007-11-27 10:21:13]

# 3
It's no error at all, that's the weird thing.
In Plesk (control panel) you need to upload a web archive (.war) file to deploy your application in tomcat.
It all works perfectly on my machine, when I upload the war in Plesk it get's a "!" sign saying it doesn't work.
When I remove the summing of the strings it does not say this anymore :/
And what do you mean with odd design? any improvement tips?
# 4
Replacepublic class Configuration {
public static final String getErrorPageLocation() {
return "errorpage.jsp";
}
}
bypublic class Configuration {
public static final String ERRORPAGE_LOCATION = "errorpage.jsp";
}
and call it asString foo = "test" + Configuration.ERRORPAGE_LOCATION;
If you're using Java 1.5 or newer, then rather use enums.
Anyway, don't you see some useful error messages in Plesk or it's logs? I never used Plesk so I can't help you any much further. But I suspect that it's a Plesk issue. I suggest you to contact the Plesk support team.
# 5
Thank you for your answer, I'll transform my configuration class to what you said.
I found something out about Plesk, when it desploys the .war it will load it one time, if it encounters any error it will say it (with the "!").
I was just testing atm if the current application would work on the internet, but since I don't have much experience with deploying war's on remote webservers, i've laid it down for a while (there is also alot more problems with deploying the .war that need to be fixed first anyways)
With the knowledge we will have our own server here that we can control without the irritating security restrictions, I'll just leave it be for now, uploading alot of mb's each time I change 1 word is frustrating through a web browser when it is going very slow hehe.