Jetty fails when user.language=tr (Turkish)

Originally published November 19, 2012.
Information provided in this post may be out of date.

Note: This bug is resolved in Jetty 8.1.8 v20121106).

Earlier this month, I filed Jetty bug report 393363 and offered a patch for a fatal error when the user.language property is set to tr (Turkish).

The use of toUpperCase() must be Locale insensitive. Otherwise, setTarget() will throw a NoSuchMethodException when the rules of the default Locale produce an unexpected result. For example, if user.language=tr, then the following would produce "setİnitialSize" rather than the expected "setInitialSize". This applies to current and past versions of Jetty.

This problem surfaced when a customer in Turkey could not get my company’s software to work on a Turkish-language OS. A work-around is to set the Java user.language property to en, but Jetty shouldn’t require this in order to work. The patch specifies an appropriate Locale:

diff --git a/jetty-plus/src/main/java/org/eclipse/jetty/plus/annotation/Injection.java b/jetty-plus/src/main/java/org/eclipse/jetty/plus/annotation/Injection.java
index 5cfad9a..5c529a6 100644
--- a/jetty-plus/src/main/java/org/eclipse/jetty/plus/annotation/Injection.java
+++ b/jetty-plus/src/main/java/org/eclipse/jetty/plus/annotation/Injection.java
@@ -140,7 +140,7 @@ public class Injection
- String setter = "set"+target.substring(0,1).toUpperCase()+target.substring(1);
+ String setter = "set"+target.substring(0,1).toUpperCase(Locale.ENGLISH)+target.substring(1);