ryomasaber / javamelody

Automatically exported from code.google.com/p/javamelody
0 stars 0 forks source link

java.lang.IllegalArgumentException: No enum const class net.bull.javamelody.Parameter.SPRİNG_TRANSFORM_PATTERN #386

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. we setup javamelody in tomcat 7.0.25, added two jars and configured web.xml 
as in user guide described. we add tomcat VM argument:
 -Duser.language=tr -Duser.country=TR
2. during startup of the tomcat with our application deployed (in Eclipse), we 
get the following exception:
java.lang.IllegalArgumentException: No enum const class 
net.bull.javamelody.Parameter.SPRİNG_TRANSFORM_PATTERN
    at java.lang.Enum.valueOf(Enum.java:196)
    at net.bull.javamelody.Parameter.valueOf(Parameter.java:27)
    at net.bull.javamelody.Parameter.valueOfIgnoreCase(Parameter.java:280)
    at net.bull.javamelody.FilterContext.setRequestTransformPatterns(FilterContext.java:171)
    at net.bull.javamelody.FilterContext.initCounters(FilterContext.java:146)
    at net.bull.javamelody.FilterContext.<init>(FilterContext.java:101)
    at net.bull.javamelody.MonitoringFilter.init(MonitoringFilter.java:111)
    at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:277)
    at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:258)
    at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:382)
    at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:103)
    at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4638)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5294)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1568)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1558)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
3.

What is the expected output? What do you see instead?
when we do not use VM parameter, it starts and monitors as excepted.

What version of the product are you using? On what application server, JDK,
operating system?
we use javamelody 1.49.0
tomcat 7.0.25
sun java 1.6.0.32
windows 7

Please provide any additional information below.
It is because of Locale code in net.bull.javamelody.Parameter file:

    static Parameter valueOfIgnoreCase(String parameter) {
        return valueOf(parameter.toUpperCase(Locale.getDefault()).trim());
    }

should be just for English locale, because in turkish locale the uppercase of 
"spring-transform-pattern" is "SPRİNG_TRANSFORM_PATTERN". as you see i 
uppercase in turkish is İ
so i think code should like:

static Parameter valueOfIgnoreCase(String parameter) {
        return valueOf(parameter.toUpperCase(Locale.ENGLISH).trim());
    }

Original issue reported on code.google.com by erdem.yi...@gmail.com on 27 Feb 2014 at 8:04

GoogleCodeExporter commented 8 years ago
This is fixed by revision 3690 in trunk. It's ready for the next release (1.50).
A snapshot build including the fix is available at:
https://javamelody.ci.cloudbees.com/job/javamelody/net.bull.javamelody$javamelod
y-core/
Thanks for the issue.

Original comment by evernat@free.fr on 28 Feb 2014 at 10:12

GoogleCodeExporter commented 8 years ago
thanks for the quick response and fix. i ll try with the snapshot version. 
regards.

Original comment by erdem.yi...@gmail.com on 1 Mar 2014 at 7:59

GoogleCodeExporter commented 8 years ago
FindBugs will warn about no-arg toUpperCase(), by the way, but if you 
explicitly specified Locale.getDefault() you are on your own.

Original comment by jgl...@cloudbees.com on 16 Apr 2014 at 7:07

GoogleCodeExporter commented 8 years ago
@jglick
Glad to see you here.
Yes, I know Findbugs. Findbugs, PMD and Checkstyle violations are displayed 
using Jenkins @ CloudBees:
https://javamelody.ci.cloudbees.com/job/javamelody/

Sonar @ CloudBees would also display that violation. (But Sonar @ CloudBees is 
currently not free for opensource projects.)

That's why, I used Locale.getDefault() in this case.
And so, the thing to know is that it is not enough and the upper case of "-" is 
"_" in Turkish.

Original comment by evernat@free.fr on 16 Apr 2014 at 7:25