[
https://issues.apache.org/jira/browse/OPENJPA-719?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12629842#action_12629842
]
Albert Lee commented on OPENJPA-719:
------------------------------------
In Turkish locale, there are 2 forms of letter 'i'. A dotted 'i' and a
non-dotted 'i'. Java String.toLowerCase and toUpperCase perform the following
case transformation:
toLowerCase( dotted 'i' (0x69) ) -> dotted 'i' (0x69)
toUpperCase( dotted 'i' (0x69) ) -> dotted 'I' (0x130)
toLowerCase( non-dotted 'I' (0x49) ) -> non-dotted 'i' (0x131)
toUpperCase( non-dotted 'I' (0x49) ) -> non-dotted 'I' (0x49)
toLowerCase( non-dotted 'i' (0x131) ) -> non-dotted 'i' (0x131)
toUpperCase( non-dotted 'i' (0x131) ) -> non-dotted 'I' (0x49)
toLowerCase( dotted 'I' (0x130) ) -> dotted 'i' (0x69)
toUpperCase( dotted 'I' (0x130) ) -> dotted 'I' (0x130)
In PCEnhance ( and most other OpenJPA code ), String.toUpperCase and
toLowerCase are used regardless of this particularity, which translated the
replaceIntField (and other variations of this method) to replace�ntField. Hence
the observed exception.
In this scenario, java fields and methods used for Reflection must not be
locale sensitive, hence toLowerCase/toUpperCase(Locale.ENGLISH) should be used
instead.
There are other use cases in OpenJPA that should also consider to be locale
insensitive, e.g. SQL reserved words should also use Locale.ENGLISH when
toUpperCase/toLowerCase is called.
Albert Lee.
> GeneralException in PCEnhancer during class transform in Turkish locale
> AppServer setting
> -----------------------------------------------------------------------------------------
>
> Key: OPENJPA-719
> URL: https://issues.apache.org/jira/browse/OPENJPA-719
> Project: OpenJPA
> Issue Type: Bug
> Components: kernel
> Affects Versions: 1.0.3, 1.0.4, 1.1.0, 1.1.1, 1.2.0, 1.2.1, 1.3.0
> Reporter: Albert Lee
> Assignee: Albert Lee
> Priority: Minor
> Fix For: 1.2.1, 1.3.0
>
>
> When Turkish locale is used in EE (AppServer) environment, entity class
> transformation failed with the following exception.
> org.apache.openjpa.util.GeneralException: An error occurred while enhancing
> itemejb3.ItemJPA. Exception message:
> org.apache.openjpa.enhance.StateManager.replace�ntField(org.apache.openjpa.enhance.PersistenceCapable,
> int)
> at org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:538)
> at
> org.apache.openjpa.enhance.PCClassFileTransformer.transform0(PCClassFileTransformer.java:146)
> at
> org.apache.openjpa.enhance.PCClassFileTransformer.transform(PCClassFileTransformer.java:120)
> at
> org.apache.openjpa.persistence.PersistenceProviderImpl$ClassTransformerImpl.transform(PersistenceProviderImpl.java:210)
> at
> com.ibm.ws.jpa.management.JPAPUnitInfo.transformClass(JPAPUnitInfo.java:1815)
> ......
> Caused by: java.lang.NoSuchMethodException:
> org.apache.openjpa.enhance.StateManager.replace�ntField(org.apache.openjpa.enhance.PersistenceCapable,
> int)
> at java.lang.Class.throwNoSuchMethodException(Class.java:283)
> at java.lang.Class.getDeclaredMethod(Class.java:609)
> at
> org.apache.openjpa.lib.util.J2DoPrivHelper$8.run(J2DoPrivHelper.java:288)
> at
> java.security.AccessController.doPrivileged(AccessController.java:251)
> at org.apache.openjpa.enhance.PCEnhancer.getMethod(PCEnhancer.java:2597)
> at
> org.apache.openjpa.enhance.PCEnhancer.getStateManagerMethod(PCEnhancer.java:2546)
> at
> org.apache.openjpa.enhance.PCEnhancer.addReplaceFieldsMethods(PCEnhancer.java:1338)
> at
> org.apache.openjpa.enhance.PCEnhancer.addPCMethods(PCEnhancer.java:1070)
> at org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:523)
> ... 33 more
> Albert Lee.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.