JDO
  1. JDO
  2. JDO-397

Locale instances are shared by different PMs (when in use as FCO)

    Details

      Description

      Tests in org.apache.jdo.tck.models.fieldtypes are using fields of Locale that are defined as FCO. The definition is only a hint to the implementation but when a FCO is actually used, the same JVM static Locale instances are persisted using different PersistenceManagers and tests fail.

      The solution:

      In org.apache.jdo.tck.models.fieldtypes.TestUtil lines 142-148:
      case(5):
      vec.add(0, Locale.CHINA.clone());
      vec.add(1, Locale.FRANCE.clone());
      vec.add(2, Locale.GERMANY.clone());
      vec.add(3, Locale.JAPAN.clone());
      vec.add(4, Locale.ITALY.clone());
      break;
      similar to cloning strings few lines above:
      case(3):
      vec.add(0, new String("Hello"));
      vec.add(1, new String("Welcome"));
      vec.add(2, new String("To The"));
      vec.add(3, new String("Beautiful"));
      vec.add(4, new String("World"));
      break;

      And also in org.apache.jdo.tck.pc.fieldtypes.AllTypes:

      public static final Locale[] Locale_values =

      { (Locale)Locale.US.clone(), (Locale)Locale.UK.clone(), (Locale)Locale.FRANCE.clone(), (Locale)Locale.GERMANY.clone(), (Locale)Locale.CANADA.clone(), (Locale)Locale.JAPAN.clone(), (Locale)Locale.ITALY.clone(), (Locale)Locale.CHINA.clone(), (Locale)Locale.KOREA.clone(), (Locale)Locale.TAIWAN.clone() }

      ;

      similar to cloning strings few lines above:

      public static final String[] String_values =

      { new String(""), new String("hello world"), new String("JDO has a very nice persistence API"), new String("JDO"), new String("Java"), new String("abcde"), new String("abcdef"), new String("JDO is a breeze to use"), new String("Java"), new String("Long-live JDO") }

      ;

        Activity

        Hide
        Craig L Russell added a comment -

        The 2.1 specification now states:

        Portable JDO applications must not depend on SCO or FCO uniquing behavior, nor on the storage
        mechanism in the datastore. Portable applications may use the same instance of these classes as field
        values in any persistence-capable class instance.

        This should resolve this issue.

        Show
        Craig L Russell added a comment - The 2.1 specification now states: Portable JDO applications must not depend on SCO or FCO uniquing behavior, nor on the storage mechanism in the datastore. Portable applications may use the same instance of these classes as field values in any persistence-capable class instance. This should resolve this issue.
        Hide
        Michelle Caisse added a comment -

        Undid previous commit. The spec will be changed to resolve this issue.

        Show
        Michelle Caisse added a comment - Undid previous commit. The spec will be changed to resolve this issue.
        Hide
        Michelle Caisse added a comment -

        Fixed with revision: 539146

        Show
        Michelle Caisse added a comment - Fixed with revision: 539146
        Hide
        Craig L Russell added a comment -

        There is a corresponding spec change that says regardless of the metadata, immutable types like Locale, Integer, String, etc. need to be sharable among FCOs.

        Show
        Craig L Russell added a comment - There is a corresponding spec change that says regardless of the metadata, immutable types like Locale, Integer, String, etc. need to be sharable among FCOs.
        Hide
        Craig L Russell added a comment -

        The specification needs to be updated to resolve this issue.

        Show
        Craig L Russell added a comment - The specification needs to be updated to resolve this issue.
        Hide
        Craig L Russell added a comment -

        Need to resolve these issues for maintenance release 1.

        Show
        Craig L Russell added a comment - Need to resolve these issues for maintenance release 1.

          People

          • Assignee:
            Craig L Russell
            Reporter:
            Ilan Kirsh
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development